java - How to reference an ${ENV} var in a propertyConfigurer bean? -


i'm trying modify this example own purposes.

i want load properties server-specific file, using this:

<beans:bean id="propertyconfigurer"     class="org.springframework.beans.factory.config.propertyplaceholderconfigurer">     <beans:property name="locations">         <beans:list>             <beans:value>${env_jdbc_config}</beans:value>         </beans:list>     </beans:property> </beans:bean> 

where env_jdbc_config enrivonment variable specifying path properties file.

this fails

`java.io.filenotfoundexception: not open servletcontext resource [/${env_jdbc_config}]` 

how can accomplish i'm trying here?

use systempropertiesmode property of configurer use system properties.
check this article, tells tips manage external properties.

if want use env variable inside other bean definition use like

<bean id="yourbean" class="com.company.yourbean"> <property name="environment" value="#{ systemproperties['env.var1'] }"/> <!-- other properties goes here....--> </bean>


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -