@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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현