springboot 2.3.4
project others dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
use bootstrap.yml
additional properties
spring:
config:
additional-location: "common-config/local/"
the jasypt can not work when project use addition-location properties
I find this bug happen in org.springframework.cloud.bootstrap.BootstrapApplicationListener.ExtendedDefaultPropertySource#add
it can be fixed if make a new class extends
org.springframework.boot.env.OriginTrackedMapPropertySource
but OriginTrackedMapPropertySource
is declared a final class, it can be modified this class to normal class?
Comment From: wilkinsona
Thanks for the report. Unfortunately, I'm not sure that I understand the problem that the solution you have described is intended to solve. Also, please note that Spring Boot 2.3.x has reached the end of its OSS support period. If a fix is required in Spring Boot it will only be made in 2.4.x and later.
To help us to understand the problem, can you please provide a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: aliciz
@wilkinsona see this sample :https://github.com/aliciz/additional-properties-demo.git
Comment From: wilkinsona
Thanks for the sample, @aliciz. Unfortunately, it doesn't appear to reproduce the problem. Unchanged, it fails to start as no DataSource URL is configured. If I comment out the MyBatis and MySQL JDBC Driver dependencies, it then starts successfully. If I leave the MyBatis dependency in place and use H2 in place of the MySQL JDBC Driver, the sample also starts successfully.
If you would like us to spend some more time investigating, can you please update the sample so that it reproduces the problem and is as minimal as possible. Unless a database is required to reproduce the problem, the sample should not require one. It should also be updated to use Spring Boot 2.4.x or later. As I mentioned above, 2.3.x has reached the end of its OSS support period.
Comment From: aliciz
@wilkinsona I update the repository , remove the mybatis and mysql dependencies.
make sample again, now I got this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hello' in value "${hello}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
Comment From: wilkinsona
Thanks for the update but the sample is still using Spring Boot 2.3.x which is no longer supported. As I said above, please upgrade to Spring Boot 2.4.x (or 2.5.x). You'll also need to upgrade Spring Cloud.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: aliciz
Thanks. After I upgraded to 2.4, I used the new features of spring.config.import
to configure additional properties, which worked fine.