springboot-actuator

This commit is contained in:
MaxKey 2021-03-02 17:08:32 +08:00
parent 2026535275
commit cc2f20dd94
7 changed files with 68 additions and 47 deletions

View File

@ -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,6 +322,9 @@ 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'

View File

@ -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<MediaType> mediaTypesList = new ArrayList<MediaType>();
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;

View File

@ -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();

View File

@ -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}")

View File

@ -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);

View File

@ -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
@ -92,3 +93,11 @@ spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.Strin
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
#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

View File

@ -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.
@ -118,3 +118,8 @@ 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}
management.security.enabled=false
#management.endpoints.jmx.exposure.include=health,info
management.endpoints.web.exposure.include=metrics,health,info,env