Description
When using the @NacosValue annotation with the autoRefreshed attribute in a Spring Boot application, the updated configuration value from Nacos is returned as an encrypted string instead of being decrypted. This issue occurs with Nacos version 2.0.4 and Jasypt version 3.0.5.
Steps to Reproduce
Configure a property in Nacos, such as ${third-auth.wx.mp.secret}, and encrypt its value.
Use the @NacosValue annotation in your Spring Boot application as follows:
@NacosValue(value = "${third-auth.wx.mp.secret}", autoRefreshed = true) private String secret;
Start the Spring Boot application.
Update the configuration value in Nacos.
Observe that the updated value is returned as an encrypted string instead of the decrypted value.
Expected Behavior
The configuration value should be automatically decrypted and updated in the application when it is refreshed, reflecting the decrypted value.
Actual Behavior
The configuration value remains encrypted even after updating the configuration in Nacos.
Current Workaround
Using new SpringApplicationBuilder().environment(new StandardEncryptableEnvironment()).sources(YourApplicationClass.class).run(args); resolves the issue by ensuring that the environment is properly configured to handle encrypted properties.
Potential Solution
Is there an alternative solution to ensure that encrypted properties are correctly decrypted and updated when using the @NacosValue annotation with the autoRefreshed attribute, aside from configuring the environment with StandardEncryptableEnvironment?
Description When using the @NacosValue annotation with the autoRefreshed attribute in a Spring Boot application, the updated configuration value from Nacos is returned as an encrypted string instead of being decrypted. This issue occurs with Nacos version 2.0.4 and Jasypt version 3.0.5. Steps to Reproduce
@NacosValue(value = "${third-auth.wx.mp.secret}", autoRefreshed = true) private String secret;
Expected Behavior The configuration value should be automatically decrypted and updated in the application when it is refreshed, reflecting the decrypted value.
Actual Behavior The configuration value remains encrypted even after updating the configuration in Nacos.
Current Workaround Using new SpringApplicationBuilder().environment(new StandardEncryptableEnvironment()).sources(YourApplicationClass.class).run(args); resolves the issue by ensuring that the environment is properly configured to handle encrypted properties.
Potential Solution Is there an alternative solution to ensure that encrypted properties are correctly decrypted and updated when using the @NacosValue annotation with the autoRefreshed attribute, aside from configuring the environment with StandardEncryptableEnvironment?
Environment Nacos Version: 2.0.4 Jasypt Version: 3.0.5 Spring Boot Version: 2.7.10