This is working:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<beans:bean id="test2" name="name" class="org.chicago.home.Test2"> </beans:bean>
<beans:bean id="test1" class="org.chicago.home.Test1">
<beans:constructor-arg ref="test2"/>
</beans:bean>
</beans:beans>
This is not. But, I find this type of configuration better. What should I do to the namespace to make this below configuration work?
Also, can I pass idref in constructor-arg? That doesn’t seem to work for me. Neither idref bean=”” nor idref local=”” inside constructor-arg is working.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
< I am pressing Ctrl + Space here, but it says beans doesn't have any child tags.
</beans>
You can use something like:
Example here
For inject constuctor, you can use:
Spring documentation for inject constructor