अगर राष्ट्रपति बदलता है, तो मुझे presidentName
के मान को application-context.xml
में तीन बार नीचे बदलना होगा:दोहराने वाले मूल्य का प्रतिनिधित्व करने के लिए एप्लिकेशन-context.xml में स्थानीय चर सेट कैसे करें?
<beans:property name="presidentName" value="Barack Obama" />
क्या application-context.xml
में स्ट्रिंग Barack Obama
का प्रतिनिधित्व करने के लिए एक बार वैरिएबल सेट करने का कोई तरीका है।
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<beans:bean id="testBeanA" class="com.TestBean">
<beans:property name="presidentName" value="Barack Obama" />
</beans:bean>
<beans:bean id="testBeanB" class="com.TestBean">
<beans:property name="presidentName" value="Barack Obama" />
</beans:bean>
<beans:bean id="testBeanC" class="com.TestBean">
<beans:property name="presidentName" value="Barack Obama" />
</beans:bean>
</beans:beans>