Code Monkey home page Code Monkey logo

Comments (12)

ulisesbocchio avatar ulisesbocchio commented on May 22, 2024

It should work, @EnableEncryptableProperties imports some configuration that registers a BeanFactoryPostProcessor to decorate property sources present in the Environment.
@EncryptablePropertySource is simpler, it just enables one specific property source with jasypt capabilities.
Do you have (or can create) a test app in Github where the problem manifests?

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

@ulisesbocchio Thanks for the reply.
I will upload a sample later.

But I saw the spring-boot package get used in the EnableEncryptablePropertySourcesPostProcessor.java, could it be a problem?

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

Here is ref repo:
https://github.com/chenrui333/jyspert-spring-sample

The command line to run is ./gradlew appRun

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

jasypt-spring-boot does not work with vanilla Spring as properties source loading is different,
Spring Boot used PropertySourceLoader, while vanilla Spring used PropertySourcesPlaceholderConfigurer

from jasypt-spring-boot.

ulisesbocchio avatar ulisesbocchio commented on May 22, 2024

Alright, let me take a look at your project...sorry for the delay

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

Thanks.

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

Any update?

from jasypt-spring-boot.

ulisesbocchio avatar ulisesbocchio commented on May 22, 2024

I'll get back to you today... sorry for the delay

from jasypt-spring-boot.

ulisesbocchio avatar ulisesbocchio commented on May 22, 2024

You're missing this in your TestConfig:

@Bean
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

That's mandatory if you want to enable PropertySources in general. Basically, without that bean, not even Spring's @PropertySource annotation works. In Spring Boot, there's an auto configuration for it in org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

Let me re-try it.
UPDATE:
Works pretty good! Thanks!

from jasypt-spring-boot.

chenrui333 avatar chenrui333 commented on May 22, 2024

Another quick question is that whether I can use gradle to setup system property that it can be picked up by Spring configuration.

from jasypt-spring-boot.

ulisesbocchio avatar ulisesbocchio commented on May 22, 2024

you gotta pass the system property to tomcat or whatever servlet container you're using when you run your application if you use it out of the box. Otherwise you can define your own SpringEncryptor bean and retrieve the password from wherever you want.

from jasypt-spring-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.