Announcement Announcement Module
Collapse
No announcement yet.
configuring variable with xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • configuring variable with xml

    Hi all, I'm trying to configure a variable with spring, in my spring-servlet.xml i wrote:

    Code:
    	<import resource="classpath:spring-context.xml" />
    in the file spring-context.xml 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>
    finally in my class i wrote:
    Code:
            @Autowired
    	@Value(value = "${address}")
    	private String address;
    Any suggestion? thanks

  • #2
    And where is your class defined? Is see no component scanning and no bean definition so your beanisn't known by spring and as such will not be injected.

    Comment

    Working...
    X