@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;
PropertySourcesPlaceholderConfigurer
works for my @Value
s 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
add a comment |
PropertySourcesPlaceholderConfigurer
works for my @Value
s 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
Were you able to solve?
– LppEdd
Mar 27 at 13:37
workaround by for injecting@Value
s 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
add a comment |
PropertySourcesPlaceholderConfigurer
works for my @Value
s 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
PropertySourcesPlaceholderConfigurer
works for my @Value
s 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
java spring-boot
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@Value
s 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
add a comment |
Were you able to solve?
– LppEdd
Mar 27 at 13:37
workaround by for injecting@Value
s 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
@Value
s and constructing data source from those resolved values– Mykhaylo Adamovych
Mar 27 at 14:34
workaround by for injecting
@Value
s 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
add a comment |
1 Answer
1
active
oldest
votes
By default Spring will use a simple/non-wrapped ConfigurationPropertySource
instead of the more complex PropertySourcesPlaceholderConfigurer
, which holds multiple PropertySource
s.
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
By default Spring will use a simple/non-wrapped ConfigurationPropertySource
instead of the more complex PropertySourcesPlaceholderConfigurer
, which holds multiple PropertySource
s.
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.
add a comment |
By default Spring will use a simple/non-wrapped ConfigurationPropertySource
instead of the more complex PropertySourcesPlaceholderConfigurer
, which holds multiple PropertySource
s.
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.
add a comment |
By default Spring will use a simple/non-wrapped ConfigurationPropertySource
instead of the more complex PropertySourcesPlaceholderConfigurer
, which holds multiple PropertySource
s.
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.
By default Spring will use a simple/non-wrapped ConfigurationPropertySource
instead of the more complex PropertySourcesPlaceholderConfigurer
, which holds multiple PropertySource
s.
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.
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
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Were you able to solve?
– LppEdd
Mar 27 at 13:37
workaround by for injecting
@Value
s 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