Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos password decryption in application.yml #385

Closed
sochina-heart opened this issue Mar 4, 2024 · 4 comments
Closed

nacos password decryption in application.yml #385

sochina-heart opened this issue Mar 4, 2024 · 4 comments

Comments

@sochina-heart
Copy link

My project uses 3.0.5 jasypt-spring-boot-starter and spring cloud alibaba 2022.0.0.0. After encrypting the nacos password, the nacos configuration cannot be obtained when the project is started. Now the nacos configuration seems to be loaded earlier than jasypt.

@sochina-heart
Copy link
Author

I just solved this problem, I introduced dependency
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> <version>4.1.0</version> </dependency> The latest springcloud does not seem to support the bootstrap.yml configuration file, so you need to introduce this maven dependency.
spring: config: import:
If this configuration is in the same configuration file as the nacos configuration information, the nacos configuration file will be given priority when the project is started. At this time, jasypt has not yet started to decrypt.
I used the bootstrap.yml configuration file to have a higher priority than application.yml. I put the nacos related configuration into the bootstrap.yml configuration file, and the configuration of the external configuration file introduced by spring into applcation.yml. This problem was successfully solved. At this time, the project At startup, the jasypt configuration file encryption will be loaded first, and then the nacos external configuration will be introduced.

@sochina-heart
Copy link
Author

My current configuration is as follows:
a
b

@zengyr49
Copy link

�i guess you were using spring boot with version lower than 2.4. In spring boot version higher than 2.4, bootstrap file is not supported.
Did you find any other solution?

@sochina-heart
Copy link
Author

�i guess you were using spring boot with version lower than 2.4. In spring boot version higher than 2.4, bootstrap file is not supported. Did you find any other solution?

The springboot version I used at the time was 3.0.x, but I forgot the specific version. I didn't find any other solution at the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants