异常输出如下:
D:\java\JDK\jdk-8u111\bin\java.exe ...
Connected to the target VM, address: '127.0.0.1:5986', transport: 'socket'
20:20:31.996 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
20:20:32.001 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.0.16.Final
20:20:32.014 [background-preinit] DEBUG org.hibernate.validator.internal.engine.resolver.TraversableResolvers - Found javax.persistence.Persistence on classpath, but no method 'getPersistenceUtil'. Assuming JPA 1 environment. All properties will per default be traversable.
20:20:32.021 [background-preinit] DEBUG org.hibernate.validator.internal.xml.config.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
20:20:32.023 [background-preinit] DEBUG org.hibernate.validator.internal.xml.config.ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL
20:20:32.023 [background-preinit] DEBUG org.hibernate.validator.internal.xml.config.ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
20:20:32.023 [background-preinit] DEBUG org.hibernate.validator.internal.xml.config.ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
20:20:32.239 [background-preinit] DEBUG org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL
20:20:32.247 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as ValidatorFactory-scoped message interpolator.
20:20:32.247 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.TraverseAllTraversableResolver as ValidatorFactory-scoped traversable resolver.
20:20:32.247 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.
20:20:32.247 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.
20:20:32.247 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.
Disconnected from the target VM, address: '127.0.0.1:5986', transport: 'socket'
Process finished with exit code 1
都不知道要搜什么了!
经过我注释配置才找到原因。
spring.datasource.druid.web-stat-filter.exclusions: 的配置没有加单引号!!!没有加单引号!!!没有加单引号!!!
无语了。
Druid监控的 yml 配置拿走不谢。
spring:
profiles:
active: dev
application:
name: db-server
datasource:
type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: 自动指定
url: jdbc:mysql://:3306/dome?serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
# 连接池配置 https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000 # druid 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位是毫秒
validation-query: select '1' from dual # druid 验证数据库连接的有效性
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true # druid 打开PSCache,并且指定每个连接上PSCache的大小
max-open-prepared-statements: 20
max-pool-prepared-statement-per-connection-size: 20
filters: stat,wall,slf4j # druid 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filter:
# druid 状态监控
stat:
enabled: true
db-type: mysql
log-slow-sql: true
slow-sql-millis: 2000 # 慢SQL记录
merge-sql: true # mergeSql功能
# druid 监控过滤器
web-stat-filter:
enabled: true
exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
# druid 监控页面
stat-view-servlet:
enabled: true
url-pattern: /druid/*
login-username: admin
login-password: 123456
reset-enable: false
欢迎点赞支持。