-Dspring.profiles.active not recognized under condition












2















I have passed -Dspring.profiles.active as a system property:



<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>#{'dev' or 'sit' or 'qa'.equals('${spring.profiles.active}') ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/cfg/process-${spring.profiles.active}.properties'}
</value>
</list>
</property>
</bean>


If I pass dev in spring.profiles.active the condition should pass but it is actuallay failing.



But it gets updated successfully with Properties named process-dev.properties.



Could someone point out what I am missing?










share|improve this question

























  • Why are you using XML configuration already and not Java annotated one?

    – tmarwen
    Nov 23 '18 at 8:48
















2















I have passed -Dspring.profiles.active as a system property:



<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>#{'dev' or 'sit' or 'qa'.equals('${spring.profiles.active}') ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/cfg/process-${spring.profiles.active}.properties'}
</value>
</list>
</property>
</bean>


If I pass dev in spring.profiles.active the condition should pass but it is actuallay failing.



But it gets updated successfully with Properties named process-dev.properties.



Could someone point out what I am missing?










share|improve this question

























  • Why are you using XML configuration already and not Java annotated one?

    – tmarwen
    Nov 23 '18 at 8:48














2












2








2








I have passed -Dspring.profiles.active as a system property:



<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>#{'dev' or 'sit' or 'qa'.equals('${spring.profiles.active}') ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/cfg/process-${spring.profiles.active}.properties'}
</value>
</list>
</property>
</bean>


If I pass dev in spring.profiles.active the condition should pass but it is actuallay failing.



But it gets updated successfully with Properties named process-dev.properties.



Could someone point out what I am missing?










share|improve this question
















I have passed -Dspring.profiles.active as a system property:



<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>#{'dev' or 'sit' or 'qa'.equals('${spring.profiles.active}') ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/cfg/process-${spring.profiles.active}.properties'}
</value>
</list>
</property>
</bean>


If I pass dev in spring.profiles.active the condition should pass but it is actuallay failing.



But it gets updated successfully with Properties named process-dev.properties.



Could someone point out what I am missing?







java spring spring-boot spring-el system-properties






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 8:40









tmarwen

8,75532543




8,75532543










asked Nov 23 '18 at 8:31









AntoAnto

114




114













  • Why are you using XML configuration already and not Java annotated one?

    – tmarwen
    Nov 23 '18 at 8:48



















  • Why are you using XML configuration already and not Java annotated one?

    – tmarwen
    Nov 23 '18 at 8:48

















Why are you using XML configuration already and not Java annotated one?

– tmarwen
Nov 23 '18 at 8:48





Why are you using XML configuration already and not Java annotated one?

– tmarwen
Nov 23 '18 at 8:48












1 Answer
1






active

oldest

votes


















2














You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')






share|improve this answer


























  • 'dev'.equals('${spring.profiles.active} - the value is not getting

    – Anto
    Nov 23 '18 at 9:14











  • Edited my response...

    – Sofo Gial
    Nov 23 '18 at 9:18











  • The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

    – Anto
    Nov 23 '18 at 9:23











  • Can you tell us exactly what you are typing on the terminal @Anto?

    – Sofo Gial
    Nov 23 '18 at 10:01













  • I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

    – Anto
    Nov 23 '18 at 10:17














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%2f53443073%2fdspring-profiles-active-not-recognized-under-condition%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









2














You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')






share|improve this answer


























  • 'dev'.equals('${spring.profiles.active} - the value is not getting

    – Anto
    Nov 23 '18 at 9:14











  • Edited my response...

    – Sofo Gial
    Nov 23 '18 at 9:18











  • The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

    – Anto
    Nov 23 '18 at 9:23











  • Can you tell us exactly what you are typing on the terminal @Anto?

    – Sofo Gial
    Nov 23 '18 at 10:01













  • I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

    – Anto
    Nov 23 '18 at 10:17


















2














You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')






share|improve this answer


























  • 'dev'.equals('${spring.profiles.active} - the value is not getting

    – Anto
    Nov 23 '18 at 9:14











  • Edited my response...

    – Sofo Gial
    Nov 23 '18 at 9:18











  • The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

    – Anto
    Nov 23 '18 at 9:23











  • Can you tell us exactly what you are typing on the terminal @Anto?

    – Sofo Gial
    Nov 23 '18 at 10:01













  • I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

    – Anto
    Nov 23 '18 at 10:17
















2












2








2







You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')






share|improve this answer















You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 9:17

























answered Nov 23 '18 at 8:34









Sofo GialSofo Gial

482616




482616













  • 'dev'.equals('${spring.profiles.active} - the value is not getting

    – Anto
    Nov 23 '18 at 9:14











  • Edited my response...

    – Sofo Gial
    Nov 23 '18 at 9:18











  • The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

    – Anto
    Nov 23 '18 at 9:23











  • Can you tell us exactly what you are typing on the terminal @Anto?

    – Sofo Gial
    Nov 23 '18 at 10:01













  • I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

    – Anto
    Nov 23 '18 at 10:17





















  • 'dev'.equals('${spring.profiles.active} - the value is not getting

    – Anto
    Nov 23 '18 at 9:14











  • Edited my response...

    – Sofo Gial
    Nov 23 '18 at 9:18











  • The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

    – Anto
    Nov 23 '18 at 9:23











  • Can you tell us exactly what you are typing on the terminal @Anto?

    – Sofo Gial
    Nov 23 '18 at 10:01













  • I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

    – Anto
    Nov 23 '18 at 10:17



















'dev'.equals('${spring.profiles.active} - the value is not getting

– Anto
Nov 23 '18 at 9:14





'dev'.equals('${spring.profiles.active} - the value is not getting

– Anto
Nov 23 '18 at 9:14













Edited my response...

– Sofo Gial
Nov 23 '18 at 9:18





Edited my response...

– Sofo Gial
Nov 23 '18 at 9:18













The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

– Anto
Nov 23 '18 at 9:23





The Value get not updated. 'dev'.equals('${spring.profiles.active}'). It returns false. But i am passing -Dspring.profiles.active=dev. It must return true

– Anto
Nov 23 '18 at 9:23













Can you tell us exactly what you are typing on the terminal @Anto?

– Sofo Gial
Nov 23 '18 at 10:01







Can you tell us exactly what you are typing on the terminal @Anto?

– Sofo Gial
Nov 23 '18 at 10:01















I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

– Anto
Nov 23 '18 at 10:17







I passed -Dspring.profiles.active=dev in argument and application.properties. I have to set these values based on environment . <value>#{'dev' =='${spring.profiles.active}' ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/process-${spring.profiles.active}.properties'} . The value update successfully with properties file name but the condition getting failed beacuse condition level the value is not passing(#{('${spring.profiles.active}'=='dev')?)

– Anto
Nov 23 '18 at 10:17






















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%2f53443073%2fdspring-profiles-active-not-recognized-under-condition%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

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]