diff --git a/build.gradle b/build.gradle index 63f8688e1186fc0ad33d995502d7965bc2310af7..971dc51da44032a48784476375da82767b1df25c 100644 --- a/build.gradle +++ b/build.gradle @@ -201,9 +201,9 @@ subprojects { //kafka support // https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients - compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.5.0' + compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.6.1' // https://mvnrepository.com/artifact/org.springframework.kafka/spring-kafka - compile group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.5.2.RELEASE' + compile group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.6.6' // https://mvnrepository.com/artifact/org.springframework.retry/spring-retry compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.3.0' @@ -215,6 +215,8 @@ subprojects { compile group: 'org.springframework.boot', name: 'spring-boot', version: "${springBootVersion}" compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: "${springBootVersion}" compile group: 'org.springframework.boot', name: 'spring-boot-actuator', version: "${springBootVersion}" + compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: "${springBootVersion}" + compile group: 'org.springframework.boot', name: 'spring-boot-actuator-autoconfigure', version: "${springBootVersion}" compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: "${springBootVersion}" compile group: 'org.springframework.boot', name: 'spring-boot-starter-freemarker', version: "${springBootVersion}" compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: "${springBootVersion}" @@ -320,7 +322,10 @@ subprojects { compile group: 'org.ogce', name: 'xpp3', version: '1.1.6' compile group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.10' compile group: 'org.passay', name: 'passay', version: '1.6.0' - + compile group: 'io.micrometer', name: 'micrometer-core', version: '1.6.4' + compile group: 'org.latencyutils', name: 'LatencyUtils', version: '2.0.3' + compile group: 'org.codehaus.woodstox', name: 'stax2-api', version: '4.2.1' + //docs compile group: 'org.mapstruct', name: 'mapstruct', version: '1.4.1.Final' compile group: 'io.swagger', name: 'swagger-annotations', version: "${swaggerVersion}" diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java index 705555cf59c361117a6cf0bd0a9a7f77e233ff88..128653d276c66f39634d5d0c155523c3c59c209c 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java @@ -29,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType; import org.springframework.boot.web.server.ConfigurableWebServerFactory; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.WebServerFactoryCustomizer; @@ -174,6 +175,8 @@ public class MvcAutoConfiguration implements InitializingBean { new MappingJackson2HttpMessageConverter(); ArrayList mediaTypesList = new ArrayList(); mediaTypesList.add(MediaType.APPLICATION_JSON); + mediaTypesList.add(MediaType.valueOf(ActuatorMediaType.V2_JSON)); + mediaTypesList.add(MediaType.valueOf(ActuatorMediaType.V3_JSON)); //mediaTypesList.add(MediaType.TEXT_PLAIN); mappingJacksonHttpMessageConverter.setSupportedMediaTypes(mediaTypesList); return mappingJacksonHttpMessageConverter; diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/RedisAutoConfiguration.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/RedisAutoConfiguration.java index fd40a26f4c492b026f5368f3c9dd1b33eafb969c..7a5c695811485d43f9ddf4d43f0a224e0a9be24f 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/RedisAutoConfiguration.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/RedisAutoConfiguration.java @@ -49,19 +49,19 @@ public class RedisAutoConfiguration implements InitializingBean { public RedisConnectionFactory redisConnFactory( @Value("${spring.redis.host}") String host, - @Value("${spring.redis.port}") + @Value("${spring.redis.port:6379}") int port, - @Value("${spring.redis.timeout}") + @Value("${spring.redis.timeout:10000}") int timeout, @Value("${spring.redis.password}") String password, - @Value("${spring.redis.lettuce.pool.max-active}") + @Value("${spring.redis.lettuce.pool.max-active:-1}") int maxActive, - @Value("${spring.redis.jedis.pool.max-wait}") + @Value("${spring.redis.jedis.pool.max-wait:1000}") int maxWait, - @Value("${spring.redis.jedis.pool.max-idle}") + @Value("${spring.redis.jedis.pool.max-idle:100}") int maxIdle, - @Value("${spring.redis.lettuce.pool.min-idle}") + @Value("${spring.redis.lettuce.pool.min-idle:0}") int minIdle) { _logger.debug("redisConnFactory init ."); RedisConnectionFactory factory = new RedisConnectionFactory(); diff --git a/maxkey-core/src/main/java/org/maxkey/configuration/EmailConfig.java b/maxkey-core/src/main/java/org/maxkey/configuration/EmailConfig.java index 9a4a508b823a1053858d5b9764f5550bc867abf5..7fd1eb35f876c1776f9d753f438beba379ae227e 100644 --- a/maxkey-core/src/main/java/org/maxkey/configuration/EmailConfig.java +++ b/maxkey-core/src/main/java/org/maxkey/configuration/EmailConfig.java @@ -35,10 +35,10 @@ public class EmailConfig { @Value("${spring.mail.host}") private String smtpHost; - @Value("${spring.mail.port}") + @Value("${spring.mail.port:465}") private Integer port; - @Value("${spring.mail.properties.ssl}") + @Value("${spring.mail.properties.ssl:false}") private boolean ssl; @Value("${spring.mail.properties.sender}") diff --git a/maxkey-web-manage/src/main/java/org/maxkey/MaxKeyMgtApplication.java b/maxkey-web-manage/src/main/java/org/maxkey/MaxKeyMgtApplication.java index 7b1a01ca4b70b8875bacca63088c4453abd4e2d3..60fcb4783e8bd0d035406bd3f07703bc3abc4775 100644 --- a/maxkey-web-manage/src/main/java/org/maxkey/MaxKeyMgtApplication.java +++ b/maxkey-web-manage/src/main/java/org/maxkey/MaxKeyMgtApplication.java @@ -19,7 +19,6 @@ package org.maxkey; import java.util.Date; import javax.servlet.ServletException; - import org.maxkey.configuration.ApplicationConfig; import org.maxkey.web.InitializeContext; import org.mybatis.spring.annotation.MapperScan; @@ -32,7 +31,6 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ComponentScan; -@SpringBootApplication @ComponentScan(basePackages = { "org.maxkey.MaxKeyMgtConfig", "org.maxkey.MaxKeyMgtMvcConfig", @@ -54,6 +52,7 @@ import org.springframework.context.annotation.ComponentScan; "org.maxkey.identity.rest" }) @MapperScan("org.maxkey.persistence.mapper,") +@SpringBootApplication public class MaxKeyMgtApplication extends SpringBootServletInitializer { private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtApplication.class); diff --git a/maxkey-web-manage/src/main/resources/application.properties b/maxkey-web-manage/src/main/resources/application.properties index 529bb66e3d0914e9161cef6888328a40e79be3b0..f5734638ab70e5adf1a92f2025511c1297dee3f6 100644 --- a/maxkey-web-manage/src/main/resources/application.properties +++ b/maxkey-web-manage/src/main/resources/application.properties @@ -25,24 +25,25 @@ mybatis.type-aliases-package=org.maxkey.domain,org.maxkey.domain.apps, mybatis.mapper-locations=classpath*:/org/maxkey/persistence/mapper/xml/mysql/*.xml mybatis.table-column-escape=true #redis -spring.redis.host=127.0.0.1 -spring.redis.port=6379 -spring.redis.password=password -spring.redis.timeout=10000 -spring.redis.jedis.pool.max-wait=1000 -spring.redis.jedis.pool.max-idle=200 -spring.redis.lettuce.pool.max-active=-1 -spring.redis.lettuce.pool.min-idle=0 +#spring.redis.host=127.0.0.1 +#spring.redis.port=6379 +#spring.redis.password=password +#spring.redis.timeout=10000 +#spring.redis.jedis.pool.max-wait=1000 +#spring.redis.jedis.pool.max-idle=200 +#spring.redis.lettuce.pool.max-active=-1 +#spring.redis.lettuce.pool.min-idle=0 #mail -spring.mail.default-encoding=utf-8 -spring.mail.host=smtp.163.com -spring.mail.port=465 -spring.mail.username=maxkey@163.com -spring.mail.password=password -spring.mail.protocol=smtp -spring.mail.properties.ssl=true -spring.mail.properties.sender=maxkey@163.com +#spring.mail.default-encoding=utf-8 +#spring.mail.host=smtp.163.com +#spring.mail.port=465 +#spring.mail.username=maxkey@163.com +#spring.mail.password=password +#spring.mail.protocol=smtp +#spring.mail.properties.ssl=true +#spring.mail.properties.sender=maxkey@163.com + #freemarker spring.freemarker.template-loader-path=classpath:/templates/views spring.freemarker.cache=false @@ -91,4 +92,12 @@ spring.kafka.producer.buffer-memory = 33554432 spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer # \u81ea\u5b9a\u4e49\u5206\u533a\u5668 -# spring.kafka.producer.properties.partitioner.class=com.felix.kafka.producer.CustomizePartitioner \ No newline at end of file +# spring.kafka.producer.properties.partitioner.class=com.felix.kafka.producer.CustomizePartitioner + +#management.server.port=9522 +#management.server.servlet.context-path=/maxkey-mgt-actuate +#management.endpoints.enabled-by-default=false +management.security.enabled=false +#management.endpoints.jmx.exposure.include=health,info +management.endpoints.web.exposure.include=metrics,health,info,env,beans + diff --git a/maxkey-web-maxkey/src/main/resources/application.properties b/maxkey-web-maxkey/src/main/resources/application.properties index 7c5a1eed980d5cc73c8af6074a53a2ddf8ffed58..4dab7209a89af7aad9bb5f7814efa079f0d4b0e8 100644 --- a/maxkey-web-maxkey/src/main/resources/application.properties +++ b/maxkey-web-maxkey/src/main/resources/application.properties @@ -39,24 +39,24 @@ mybatis.mapper-locations=classpath*:/org/maxkey/persistence/mapper/xml/mysql/*.x mybatis.table-column-escape=true #redis -spring.redis.host=127.0.0.1 -spring.redis.port=6379 -spring.redis.password=password -spring.redis.timeout=10000 -spring.redis.jedis.pool.max-wait=1000 -spring.redis.jedis.pool.max-idle=200 -spring.redis.lettuce.pool.max-active=-1 -spring.redis.lettuce.pool.min-idle=0 +#spring.redis.host=127.0.0.1 +#spring.redis.port=6379 +#spring.redis.password=password +#spring.redis.timeout=10000 +#spring.redis.jedis.pool.max-wait=1000 +#spring.redis.jedis.pool.max-idle=200 +#spring.redis.lettuce.pool.max-active=-1 +#spring.redis.lettuce.pool.min-idle=0 #mail -spring.mail.default-encoding=utf-8 -spring.mail.host=smtp.163.com -spring.mail.port=465 -spring.mail.username=maxkey@163.com -spring.mail.password=password -spring.mail.protocol=smtp -spring.mail.properties.ssl=true -spring.mail.properties.sender=maxkey@163.com +#spring.mail.default-encoding=utf-8 +#spring.mail.host=smtp.163.com +#spring.mail.port=465 +#spring.mail.username=maxkey@163.com +#spring.mail.password=password +#spring.mail.protocol=smtp +#spring.mail.properties.ssl=true +#spring.mail.properties.sender=maxkey@163.com spring.mail.properties.mailotp.message.subject=MaxKey One Time PassWord spring.mail.properties.mailotp.message.template={0} You Token is {1} , it validity in {2} minutes. @@ -117,4 +117,9 @@ spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.Str maxkey.swagger.enable=true maxkey.swagger.title=MaxKey\u5355\u70b9\u767b\u5f55\u8ba4\u8bc1\u7cfb\u7edfapi\u6587\u6863 maxkey.swagger.description=MaxKey\u5355\u70b9\u767b\u5f55\u8ba4\u8bc1\u7cfb\u7edfapi\u6587\u6863 -maxkey.swagger.version=${application.formatted-version} \ No newline at end of file +maxkey.swagger.version=${application.formatted-version} + +management.security.enabled=false +#management.endpoints.jmx.exposure.include=health,info +management.endpoints.web.exposure.include=metrics,health,info,env +