springboot使用jasypt加密报错:java.lang.IllegalStateException: Logback configuration error detected

背景:

springboot使用jasypt加密数据库用户密码时,在pom.xml中引入jasypt-spring-boot-starter时,与原有logback整合kafka日志部分冲突,启动报错如下:

java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.spi.Interpreter@37:14 - RuntimeException in Action for tag [appender] org.apache.kafka.common.KafkaException: Failed to construct kafka producer
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:82)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:292)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:265)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:228)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:201)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at com.nuonuo.tax.bspt.BsptApplication.main(BsptApplication.java:16)

logback-spring.xml如下:

springboot使用jasypt加密报错:java.lang.IllegalStateException: Logback configuration error detected_第1张图片

 

 

问题原因及解决:

jasypt-spring-boot-starter.jar与logback日志部分引入jar冲突。

虽然很多报文在使用jasypt加密时都是引用jasypt-spring-boot-starter.jar(可能会引入更多jar进来),可以使用下面:


	com.github.ulisesbocchio
	jasypt-spring-boot
	2.1.0

springboot使用jasypt加密报错:java.lang.IllegalStateException: Logback configuration error detected_第2张图片

具体详细介绍:https://github.com/ulisesbocchio/jasypt-spring-boot

 

 

附加密步骤:

Spring Boot使用jasypt处理加密问题

 

 

 

 

你可能感兴趣的:(#,Spring)