0

I want to concatenate a string dynamically in springs.The string is

<bean id="mBeanExporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> <property name="beans"> <map> <entry key="bean:name=HealthChk" value-ref="#{'HealthChk-'.concat(_LOCALHOST_)}"/> </map> </property> <property name="server" ref="mBeanServer"/> </bean>

I am passing _LOCALHOST_ value from script which should replace this with the IPAddress.Can anyone help me out how the concat can be done?value-ref="#{'HealthChk-'.concat(_LOCALHOST_)} needs to be corrected.

Thanks

user3062513
  • 410
  • 1
  • 10
  • 19

1 Answers1

0

The expression in the "#{}" placeholders is in the Spring Expression Language. String concatenation is just like Java (i.e. you use a "+" operator). See reference guide for details and examples.

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • Thanks for the info.For the String #{'HealthChk-'+$(_LOCALHOST_)}..Its failing.Can you Please tell me how the operator needs to be defined._LOCALHOST_ is dynamically replaced with the value configured in Script file. – user3062513 Apr 21 '14 at 09:30
  • What's the "Script file"? Maybe "#{'HealthChk-'+@environment.getProperty('LOCALHOST')}" (it depends what "LOCALHOST" is, how you should resolve it). – Dave Syer Apr 21 '14 at 13:29