🔨 规范化配置.
This commit is contained in:
@@ -36,24 +36,47 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
|||||||
@Value("${management.endpoints.web.base-path:''}")
|
@Value("${management.endpoints.web.base-path:''}")
|
||||||
private String managementEndpoints;
|
private String managementEndpoints;
|
||||||
|
|
||||||
|
@Value("${springdoc.api-docs.enabled}")
|
||||||
|
private Boolean apiDocsEnabled;
|
||||||
|
|
||||||
|
@Value("${spring.datasource.druid.stat-view-servlet.enabled}")
|
||||||
|
private Boolean druidConsoleEnabled;
|
||||||
|
|
||||||
|
@Value("#{'${management.endpoints.web.exposure.include}' != 'shutdown'}")
|
||||||
|
private Boolean springBootActuatorEnabled;
|
||||||
|
|
||||||
|
@Value("${spring.boot.admin.client.enabled}")
|
||||||
|
private Boolean springBootAdminClientEnabled;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
String line = AnsiAppender.create()
|
AnsiAppender appender = AnsiAppender.create()
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n")
|
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n");
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
// swagger 地址
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n")
|
if (apiDocsEnabled) {
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n")
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n");
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
|
}
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n")
|
// druid 控制台
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
|
if (druidConsoleEnabled) {
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n");
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"")
|
}
|
||||||
.toString();
|
// admin actuator 端点
|
||||||
|
if (springBootActuatorEnabled) {
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n");
|
||||||
|
}
|
||||||
|
// admin server 控制台
|
||||||
|
if (springBootAdminClientEnabled) {
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n");
|
||||||
|
}
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"");
|
||||||
Threads.start(() -> {
|
Threads.start(() -> {
|
||||||
Threads.sleep(1000L);
|
Threads.sleep(1000L);
|
||||||
System.out.println(line);
|
System.out.println(appender);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ ${AnsiColor.BRIGHT_GREEN}:: Application Name ${AnsiColor.BLUE}${spring.appli
|
|||||||
${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version}
|
${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version}
|
||||||
${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
|
${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
|
||||||
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
|
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
|
||||||
|
${AnsiColor.BRIGHT_GREEN}:: Demo Mode ${AnsiColor.BLUE}${orion.demo}
|
||||||
${AnsiColor.DEFAULT}
|
${AnsiColor.DEFAULT}
|
||||||
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -38,10 +37,9 @@ import java.util.Optional;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2022/6/21 11:22
|
* @since 2022/6/21 11:22
|
||||||
*/
|
*/
|
||||||
@Profile({"dev"})
|
|
||||||
@ConditionalOnClass({OpenAPI.class})
|
@ConditionalOnClass({OpenAPI.class})
|
||||||
@EnableConfigurationProperties(SwaggerConfig.class)
|
@EnableConfigurationProperties(SwaggerConfig.class)
|
||||||
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true)
|
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
||||||
public class OrionSwaggerAutoConfiguration {
|
public class OrionSwaggerAutoConfiguration {
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ spring:
|
|||||||
initial-size: 0
|
initial-size: 0
|
||||||
min-idle: 1
|
min-idle: 1
|
||||||
max-active: 5
|
max-active: 5
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: false
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -15,6 +17,19 @@ spring:
|
|||||||
threads: 2
|
threads: 2
|
||||||
netty-threads: 2
|
netty-threads: 2
|
||||||
minimum-idle-size: 2
|
minimum-idle-size: 2
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
enabled: false
|
||||||
|
server:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
enabled-by-default: false
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: shutdown
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ spring:
|
|||||||
min-idle: 5
|
min-idle: 5
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
max-active: 20
|
max-active: 20
|
||||||
web-stat-filter:
|
# 控制台
|
||||||
enabled: true
|
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
login-username: ${DRUID_USERNAME:admin}
|
||||||
|
login-password: ${DRUID_PASSWORD:admin}
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -31,6 +34,16 @@ spring:
|
|||||||
quartz:
|
quartz:
|
||||||
threadPool:
|
threadPool:
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
enabled: true
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
enabled-by-default: true
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
api-docs:
|
api-docs:
|
||||||
@@ -40,6 +53,7 @@ springdoc:
|
|||||||
|
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: false
|
enable: false
|
||||||
|
production: true
|
||||||
|
|
||||||
orion:
|
orion:
|
||||||
# 是否为演示模式
|
# 是否为演示模式
|
||||||
|
|||||||
@@ -40,13 +40,14 @@ spring:
|
|||||||
# 最大生存的时间
|
# 最大生存的时间
|
||||||
max-evictable-idle-time-millis: 900000
|
max-evictable-idle-time-millis: 900000
|
||||||
validation-query: SELECT 1
|
validation-query: SELECT 1
|
||||||
web-stat-filter:
|
# 控制台
|
||||||
enabled: true
|
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
login-username:
|
login-username:
|
||||||
login-password:
|
login-password:
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -88,7 +89,7 @@ spring:
|
|||||||
misfireThreshold: 60000
|
misfireThreshold: 60000
|
||||||
clusterCheckinInterval: 5000
|
clusterCheckinInterval: 5000
|
||||||
isClustered: true
|
isClustered: true
|
||||||
#连接池
|
# 连接池
|
||||||
threadPool:
|
threadPool:
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 5
|
threadCount: 5
|
||||||
@@ -98,12 +99,16 @@ spring:
|
|||||||
admin:
|
admin:
|
||||||
context-path: /admin
|
context-path: /admin
|
||||||
client:
|
client:
|
||||||
|
enabled: true
|
||||||
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path}
|
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path}
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
|
enabled-by-default: true
|
||||||
web:
|
web:
|
||||||
base-path: /actuator
|
base-path: /actuator
|
||||||
exposure:
|
exposure:
|
||||||
|
|||||||
Reference in New Issue
Block a user