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

jasypt doesn't decrypt xml configured properties. #92

Open
pfmiles opened this issue Apr 15, 2022 · 0 comments
Open

jasypt doesn't decrypt xml configured properties. #92

pfmiles opened this issue Apr 15, 2022 · 0 comments

Comments

@pfmiles
Copy link

pfmiles commented Apr 15, 2022

hi there,
I'm using springboot v2.6.3 with spring version 5.3.15.
And here's my starter class source:

@SpringBootApplication
@EnableDubbo
@EnableEncryptableProperties
@PropertySource({ "classpath:app-patrolworker/config/application-worker.properties" })
@ImportResource({ "classpath:META-INF/spring/xhunterlib-crawler-polardb.xml",
                  "classpath:app-patrolworker/spring/*.xml" })
public class WorkerApplication {
    private static final Logger logger = LoggerFactory.getLogger(WorkerApplication.class);

    public static void main(String... args) {
        String parLvStr = System.getProperty("parallelLevel");
        Preconditions.checkArgument(
            StringUtils.isNotBlank(parLvStr) && StringUtils.isNumeric(parLvStr),
            "Startup VM property 'parallelLeval' must be specified.");
        String schedTag = System.getProperty("schedTag");
        Preconditions.checkArgument(StringUtils.isNotBlank(schedTag)
                                    && ResourceManagementService.checkSchedTagFormat(schedTag),
            "Startup VM property 'schedTag' must be specified, and must be of form: 'patrol-clusterName-schedId'.");
        logger.info(MessageFormatter.format(
            "Loading worker application with schedTag: {}, parallelLevel: {}.", schedTag,
            parLvStr));
        try {
            SpringApplication.run(WorkerApplication.class, args);
        } catch (Throwable t) {
            ExceptionUtils.printAsString(t);
            throw t;
        }
    }
}

there are some encrypted properties in the application-worker.properties, and the start up logs also showing that jasypt recognized and processed this property file:

12:27:48.283 [main] INFO  jasyptspringboot.EncryptablePropertySourceConverter - Converting PropertySource class path resource [app-patrolworker/config/application-worker-test.properties] [org.springframework.core.io.support.ResourcePropertySource] to EncryptableMapPropertySourceWrapper

When I inject bean properties using @Value annotation, all things went well, but when I doing that in a xml configuration manner, those encrypted properties didn't get a decrypt.

I googled for a while and I did find a solution using a class named org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer to solve this but it's for spring 3.x apparently. In recent versions of jasypt, it's gone.

would you please support xml configuration properties decryption with spring 5.x?
thanks.

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

1 participant