It seems to be easy, but it does not work. I can't paste system property in my easy example:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:client.properties</value> </list> </property> <property name="searchSystemEnvironment" value="true"/> <property name="ignoreResourceNotFound" value="true"/> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/> </bean> <bean id="client" class="com.epam.spring.Client" c:id="${id}" p:fullName="#{systemEnvironment['user.name']}" p:greeting="${greeting}" /> Bean Client is ok, but field fullName is always null. In every case i have in fullName NULL, help me, please, what's wrong? I tried to use other systemEnvironment['something.else'], but it does not help. Tries like this: p:fullName="#{ T(java.lang.System).getenv().get('java.version') }" But id don't want to work.
-Dprop=valueand are distinct from OS environment variables. Using SpEL andsystemEnvironmentaccesses the latter, not "system properties" mentioned in the title. System properties are accessed bysystemProperties, example in this answer: stackoverflow.com/a/22630883/658826