Hi all, I'm trying to configure a variable with spring, in my spring-servlet.xml i wrote:
in the file spring-context.xml i wrote:Code:<import resource="classpath:spring-context.xml" />
finally in my class i wrote:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder properties-ref="defaultProperties" /> <util:properties id="defaultProperties"> <prop key="address">this is an address</prop> </util:properties> </beans>
Any suggestion? thanksCode:@Autowired @Value(value = "${address}") private String address;


Reply With Quote