@ConfigurationProperties does not use PropertySourcesPlaceholderConfigurerUse @ConfigurationProperties over non-managed @BeanDoes a finally block always get executed in Java?How does the Java 'for each' loop work?Why does Java have transient fields?Does Java support default parameter values?What does 'synchronized' mean?Why does this code using random strings print “hello world”?Unable to bind map with complex key from spring boot yaml file using @ConfigurationPropertiesSpringboot ConstraintValidator not reading configurationProperties with MockitoJUnitRunner or SpringBootIn a SpringBoot application, how to set @ConfigurationProperties(prefix = …) dynamically?Spring post and get not found

Prime parity peregrination

What does Mildred mean by this line in Three Billboards Outside Ebbing, Missouri?

In native German words, is Q always followed by U, as in English?

Does anyone know what these symbols mean?

Can the passive "être + verbe" sometimes mean the past?

How was film developed in the late 1920s?

Questions about authorship rank and academic politics

Getting geometries of hurricane's 'cone of uncertainty' using shapely?

Procedurally generate regions on island

Why do I need two parameters in an HTTP parameter pollution attack?

What does BSCT stand for?

Should I share with a new service provider a bill from its competitor?

Do space suits measure "methane" levels or other biological gases?

What is "oversubscription" in Networking?

Was it really unprofessional of me to leave without asking for a raise first?

Can 'leave' mean 'forget'?

Should I report a leak of confidential HR information?

3D nonogram – Name the object

How can my story take place on Earth without referring to our existing cities and countries?

How can a valley surrounded by mountains be fertile and rainy?

Is there a nice way to assign std::minmax(a, b) to std::tie(a, b)?

cannot execute script while its permission is 'x'

Generate and graph the Recamán Sequence

Can a single server be associated with multiple domains?



@ConfigurationProperties does not use PropertySourcesPlaceholderConfigurer


Use @ConfigurationProperties over non-managed @BeanDoes a finally block always get executed in Java?How does the Java 'for each' loop work?Why does Java have transient fields?Does Java support default parameter values?What does 'synchronized' mean?Why does this code using random strings print “hello world”?Unable to bind map with complex key from spring boot yaml file using @ConfigurationPropertiesSpringboot ConstraintValidator not reading configurationProperties with MockitoJUnitRunner or SpringBootIn a SpringBoot application, how to set @ConfigurationProperties(prefix = …) dynamically?Spring post and get not found






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















PropertySourcesPlaceholderConfigurer works for my @Values but not used for the following advertised datasource configuration



@Bean
@ConfigurationProperties(prefix = "datasource")
public DataSource dataSource()
return DataSourceBuilder.create().build();



I customized PropertySourcesPlaceholderConfigurer to decode passwords in configuration file but decoding functionality is not triggered for this exact place, while it works in other places. Could you please advise?










share|improve this question






















  • Were you able to solve?

    – LppEdd
    Mar 27 at 13:37











  • workaround by for injecting @Values and constructing data source from those resolved values

    – Mykhaylo Adamovych
    Mar 27 at 14:34











  • Okay, I'll delete the answer.

    – LppEdd
    Mar 27 at 14:38











  • Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

    – Mykhaylo Adamovych
    Mar 28 at 14:23

















1















PropertySourcesPlaceholderConfigurer works for my @Values but not used for the following advertised datasource configuration



@Bean
@ConfigurationProperties(prefix = "datasource")
public DataSource dataSource()
return DataSourceBuilder.create().build();



I customized PropertySourcesPlaceholderConfigurer to decode passwords in configuration file but decoding functionality is not triggered for this exact place, while it works in other places. Could you please advise?










share|improve this question






















  • Were you able to solve?

    – LppEdd
    Mar 27 at 13:37











  • workaround by for injecting @Values and constructing data source from those resolved values

    – Mykhaylo Adamovych
    Mar 27 at 14:34











  • Okay, I'll delete the answer.

    – LppEdd
    Mar 27 at 14:38











  • Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

    – Mykhaylo Adamovych
    Mar 28 at 14:23













1












1








1








PropertySourcesPlaceholderConfigurer works for my @Values but not used for the following advertised datasource configuration



@Bean
@ConfigurationProperties(prefix = "datasource")
public DataSource dataSource()
return DataSourceBuilder.create().build();



I customized PropertySourcesPlaceholderConfigurer to decode passwords in configuration file but decoding functionality is not triggered for this exact place, while it works in other places. Could you please advise?










share|improve this question














PropertySourcesPlaceholderConfigurer works for my @Values but not used for the following advertised datasource configuration



@Bean
@ConfigurationProperties(prefix = "datasource")
public DataSource dataSource()
return DataSourceBuilder.create().build();



I customized PropertySourcesPlaceholderConfigurer to decode passwords in configuration file but decoding functionality is not triggered for this exact place, while it works in other places. Could you please advise?







java spring-boot






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 12:39









Mykhaylo AdamovychMykhaylo Adamovych

9,28617 gold badges67 silver badges96 bronze badges




9,28617 gold badges67 silver badges96 bronze badges












  • Were you able to solve?

    – LppEdd
    Mar 27 at 13:37











  • workaround by for injecting @Values and constructing data source from those resolved values

    – Mykhaylo Adamovych
    Mar 27 at 14:34











  • Okay, I'll delete the answer.

    – LppEdd
    Mar 27 at 14:38











  • Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

    – Mykhaylo Adamovych
    Mar 28 at 14:23

















  • Were you able to solve?

    – LppEdd
    Mar 27 at 13:37











  • workaround by for injecting @Values and constructing data source from those resolved values

    – Mykhaylo Adamovych
    Mar 27 at 14:34











  • Okay, I'll delete the answer.

    – LppEdd
    Mar 27 at 14:38











  • Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

    – Mykhaylo Adamovych
    Mar 28 at 14:23
















Were you able to solve?

– LppEdd
Mar 27 at 13:37





Were you able to solve?

– LppEdd
Mar 27 at 13:37













workaround by for injecting @Values and constructing data source from those resolved values

– Mykhaylo Adamovych
Mar 27 at 14:34





workaround by for injecting @Values and constructing data source from those resolved values

– Mykhaylo Adamovych
Mar 27 at 14:34













Okay, I'll delete the answer.

– LppEdd
Mar 27 at 14:38





Okay, I'll delete the answer.

– LppEdd
Mar 27 at 14:38













Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

– Mykhaylo Adamovych
Mar 28 at 14:23





Thanks for your answer. I had few other obstacles and lean to dumb workaraund.

– Mykhaylo Adamovych
Mar 28 at 14:23












1 Answer
1






active

oldest

votes


















1














By default Spring will use a simple/non-wrapped ConfigurationPropertySource instead of the more complex PropertySourcesPlaceholderConfigurer, which holds multiple PropertySources.



An example can be found inside DataSourceBuilder itself



private void bind(DataSource result) 
ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
aliases.addAliases("url", "jdbc-url");
aliases.addAliases("username", "user");
Binder binder = new Binder(source.withAliases(aliases));
binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));



For that snippet, normally this.properties is populated using the DataSourceProperties Bean, which is a @ConfigurationProperties annotated class



@ConfigurationProperties(prefix = "spring.datasource")
public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {



The thing is, @ConfigurationProperties map 1:1 to a properties file, it is very opinionated.
@Value is a different beast.




I tackled a completely custom implementation in this answer.

You might find it valuable.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55338016%2fconfigurationproperties-does-not-use-propertysourcesplaceholderconfigurer%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    By default Spring will use a simple/non-wrapped ConfigurationPropertySource instead of the more complex PropertySourcesPlaceholderConfigurer, which holds multiple PropertySources.



    An example can be found inside DataSourceBuilder itself



    private void bind(DataSource result) 
    ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
    ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
    aliases.addAliases("url", "jdbc-url");
    aliases.addAliases("username", "user");
    Binder binder = new Binder(source.withAliases(aliases));
    binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));



    For that snippet, normally this.properties is populated using the DataSourceProperties Bean, which is a @ConfigurationProperties annotated class



    @ConfigurationProperties(prefix = "spring.datasource")
    public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {



    The thing is, @ConfigurationProperties map 1:1 to a properties file, it is very opinionated.
    @Value is a different beast.




    I tackled a completely custom implementation in this answer.

    You might find it valuable.






    share|improve this answer





























      1














      By default Spring will use a simple/non-wrapped ConfigurationPropertySource instead of the more complex PropertySourcesPlaceholderConfigurer, which holds multiple PropertySources.



      An example can be found inside DataSourceBuilder itself



      private void bind(DataSource result) 
      ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
      ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
      aliases.addAliases("url", "jdbc-url");
      aliases.addAliases("username", "user");
      Binder binder = new Binder(source.withAliases(aliases));
      binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));



      For that snippet, normally this.properties is populated using the DataSourceProperties Bean, which is a @ConfigurationProperties annotated class



      @ConfigurationProperties(prefix = "spring.datasource")
      public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {



      The thing is, @ConfigurationProperties map 1:1 to a properties file, it is very opinionated.
      @Value is a different beast.




      I tackled a completely custom implementation in this answer.

      You might find it valuable.






      share|improve this answer



























        1












        1








        1







        By default Spring will use a simple/non-wrapped ConfigurationPropertySource instead of the more complex PropertySourcesPlaceholderConfigurer, which holds multiple PropertySources.



        An example can be found inside DataSourceBuilder itself



        private void bind(DataSource result) 
        ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
        ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
        aliases.addAliases("url", "jdbc-url");
        aliases.addAliases("username", "user");
        Binder binder = new Binder(source.withAliases(aliases));
        binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));



        For that snippet, normally this.properties is populated using the DataSourceProperties Bean, which is a @ConfigurationProperties annotated class



        @ConfigurationProperties(prefix = "spring.datasource")
        public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {



        The thing is, @ConfigurationProperties map 1:1 to a properties file, it is very opinionated.
        @Value is a different beast.




        I tackled a completely custom implementation in this answer.

        You might find it valuable.






        share|improve this answer















        By default Spring will use a simple/non-wrapped ConfigurationPropertySource instead of the more complex PropertySourcesPlaceholderConfigurer, which holds multiple PropertySources.



        An example can be found inside DataSourceBuilder itself



        private void bind(DataSource result) 
        ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
        ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
        aliases.addAliases("url", "jdbc-url");
        aliases.addAliases("username", "user");
        Binder binder = new Binder(source.withAliases(aliases));
        binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));



        For that snippet, normally this.properties is populated using the DataSourceProperties Bean, which is a @ConfigurationProperties annotated class



        @ConfigurationProperties(prefix = "spring.datasource")
        public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {



        The thing is, @ConfigurationProperties map 1:1 to a properties file, it is very opinionated.
        @Value is a different beast.




        I tackled a completely custom implementation in this answer.

        You might find it valuable.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 25 at 13:36

























        answered Mar 25 at 13:23









        LppEddLppEdd

        10.4k3 gold badges19 silver badges50 bronze badges




        10.4k3 gold badges19 silver badges50 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.








            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55338016%2fconfigurationproperties-does-not-use-propertysourcesplaceholderconfigurer%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript