diff --git a/distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java b/distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java
index 5617754..e156d44 100644
--- a/distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java
+++ b/distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java
@@ -12,6 +12,6 @@
@SpringBootApplication
public class JobApplication {
public static void main(String[] args) {
- SpringApplication.run(JobApplication.class,args);
+ SpringApplication.run(JobApplication.class, args);
}
}
diff --git a/logs/xxl-job/xxl-job-admin.log.2020-01-11.zip b/logs/xxl-job/xxl-job-admin.log.2020-01-11.zip
new file mode 100644
index 0000000..d07540b
Binary files /dev/null and b/logs/xxl-job/xxl-job-admin.log.2020-01-11.zip differ
diff --git a/okay-spring-boot-starter/pom.xml b/okay-spring-boot-starter/pom.xml
new file mode 100644
index 0000000..62db9b8
--- /dev/null
+++ b/okay-spring-boot-starter/pom.xml
@@ -0,0 +1,61 @@
+
+
+
+ 4.0.0
+
+ cn.haoxiaoyong.okay
+ okay-spring-boot-starter
+ 0.0.2-SNAPSHO
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ 2.1.4.RELEASE
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ 2.1.4.RELEASE
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.1.4.RELEASE
+
+
+ NONE
+
+
+
+
+ repackage
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/annotation/EnableOkay.java b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/annotation/EnableOkay.java
new file mode 100644
index 0000000..3545d5e
--- /dev/null
+++ b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/annotation/EnableOkay.java
@@ -0,0 +1,27 @@
+package cn.haoxiaoyong.okay.starter.annotation;
+
+import cn.haoxiaoyong.okay.starter.config.OkayProperties;
+import cn.haoxiaoyong.okay.starter.config.OkayStarterAutoConfiguration;
+import cn.haoxiaoyong.okay.starter.model.Okay;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Import;
+
+import java.lang.annotation.*;
+
+/**
+ * @author haoxiaoyong on 2020/3/20 下午 4:05
+ * e-mail: hxyHelloWorld@163.com
+ * github: https://github.com/haoxiaoyong1014
+ * Blog: www.haoxiaoyong.cn
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@EnableConfigurationProperties(OkayProperties.class)
+@ConditionalOnWebApplication
+@Import(OkayStarterAutoConfiguration.class)
+public @interface EnableOkay {
+
+}
diff --git a/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java
new file mode 100644
index 0000000..0764d23
--- /dev/null
+++ b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java
@@ -0,0 +1,52 @@
+package cn.haoxiaoyong.okay.starter.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * @author haoxiaoyong on 2020/3/20 上午 11:04
+ * e-mail: hxyHelloWorld@163.com
+ * github: https://github.com/haoxiaoyong1014
+ * Blog: www.haoxiaoyong.cn
+ */
+@ConfigurationProperties(prefix = "okay.config")
+public class OkayProperties {
+
+ private String platform;
+
+ private String channel;
+
+ private Boolean enable;
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getChannel() {
+ return channel;
+ }
+
+ public void setChannel(String channel) {
+ this.channel = channel;
+ }
+
+ public Boolean getEnable() {
+ return enable;
+ }
+
+ public void setEnable(Boolean enable) {
+ this.enable = enable;
+ }
+
+ @Override
+ public String toString() {
+ return "OkayProperties{" +
+ "platform='" + platform + '\'' +
+ ", channel='" + channel + '\'' +
+ ", enable=" + enable +
+ '}';
+ }
+}
diff --git a/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java
new file mode 100644
index 0000000..ec0a2e1
--- /dev/null
+++ b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java
@@ -0,0 +1,37 @@
+package cn.haoxiaoyong.okay.starter.config;
+
+import cn.haoxiaoyong.okay.starter.model.Okay;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author haoxiaoyong on 2020/3/20 上午 10:48
+ * e-mail: hxyHelloWorld@163.com
+ * github: https://github.com/haoxiaoyong1014
+ * Blog: www.haoxiaoyong.cn
+ */
+@Configuration
+@EnableConfigurationProperties(OkayProperties.class)
+@ConditionalOnClass(Okay.class)
+@ConditionalOnWebApplication
+public class OkayStarterAutoConfiguration {
+
+ /**
+ * 当存在okay.config.enable=true的配置时,这个Okay bean才生效
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ @ConditionalOnProperty(prefix = "okay.config", name = "enable", havingValue = "true")
+ public Okay defaultStudent(OkayProperties okayProperties) {
+ Okay okay = new Okay();
+ okay.setPlatform(okayProperties.getPlatform());
+ okay.setChannel(okayProperties.getChannel());
+ okay.setEnable(okayProperties.getEnable());
+ return okay;
+ }
+}
diff --git a/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java
new file mode 100644
index 0000000..85895b4
--- /dev/null
+++ b/okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java
@@ -0,0 +1,49 @@
+package cn.haoxiaoyong.okay.starter.model;
+
+/**
+ * @author haoxiaoyong on 2020/3/20 下午 1:27
+ * e-mail: hxyHelloWorld@163.com
+ * github: https://github.com/haoxiaoyong1014
+ * Blog: www.haoxiaoyong.cn
+ */
+public class Okay {
+
+ private String platform;
+
+ private String channel;
+
+ private Boolean enable;
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getChannel() {
+ return channel;
+ }
+
+ public void setChannel(String channel) {
+ this.channel = channel;
+ }
+
+ public Boolean getEnable() {
+ return enable;
+ }
+
+ public void setEnable(Boolean enable) {
+ this.enable = enable;
+ }
+
+ @Override
+ public String toString() {
+ return "Okay{" +
+ "platform='" + platform + '\'' +
+ ", channel='" + channel + '\'' +
+ ", enable=" + enable +
+ '}';
+ }
+}
diff --git a/okay-spring-boot-starter/src/main/resources/META-INF/spring.factories b/okay-spring-boot-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..a8fd9db
--- /dev/null
+++ b/okay-spring-boot-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,2 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+ cn.haoxiaoyong.okay.starter.config.OkayStarterAutoConfiguration
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5d74d8a..a6eb2b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,5 +32,6 @@
springboot-idempotent
distributed-job
mybatis-plus-example
+ okay-spring-boot-starter
\ No newline at end of file
diff --git a/springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java b/springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java
index 0f82569..f29492c 100644
--- a/springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java
+++ b/springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java
@@ -30,6 +30,7 @@ public class TokenStoreConfig {
/**
* 用于存放token
+ *
* @return
*/
@Bean
@@ -43,26 +44,28 @@ public TokenStore redisTokenStore() {
*/
@Configuration
@ConditionalOnProperty(prefix = "merryyou.security.oauth2", name = "storeType", havingValue = "jwt", matchIfMissing = true)
- public static class JwtTokenCofnig{
+ public static class JwtTokenCofnig {
@Autowired
private OAuth2Properties oAuth2Properties;
/**
* 使用jwtTokenStore存储token
+ *
* @return
*/
@Bean
- public TokenStore jwtTokenStore(){
+ public TokenStore jwtTokenStore() {
return new JwtTokenStore(jwtAccessTokenConverter());
}
/**
* 用于生成jwt
+ *
* @return
*/
@Bean
- public JwtAccessTokenConverter jwtAccessTokenConverter(){
+ public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();
accessTokenConverter.setSigningKey(oAuth2Properties.getJwtSigningKey());//生成签名的key
return accessTokenConverter;
@@ -70,11 +73,12 @@ public JwtAccessTokenConverter jwtAccessTokenConverter(){
/**
* 用于扩展JWT
+ *
* @return
*/
@Bean
@ConditionalOnMissingBean(name = "jwtTokenEnhancer")
- public TokenEnhancer jwtTokenEnhancer(){
+ public TokenEnhancer jwtTokenEnhancer() {
return new MerryyouJwtTokenEnhancer();
}