How can I pass VM args to applicationContext in spring -
how can pass vm args (java -dport = 5) application context?
i want configure port dynamically user, using application context.
in case trying access vm arguments in spring application context, add below bean definition in context file:
<bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="ignoreunresolvableplaceholders" value="true"></property> </bean> and access vm args ${vm_property}.
e.g if passed –dport=5, can accessed as
<bean class="com.testing.test.myclass"> <property name="myproperty" value="${port}"></property> </bean>
Comments
Post a Comment