I have a very simple bean that's annotated with @Service and has an @Autowired property. I'm using context:component-scan in the configuration file which works fine to load the service bean. However, nothing I do seems to get the container to recognize the @Autowired annotation on the property. In fact if I state @Autowired(required=true) the bean still loads with no error, but the property is injected.
The relevant lines in the configuration are:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"
>
...
<context:annotation-config/>
<bean id="domainA" class="org.ccf.roswell.access.AccessControlDomainS ervice"/>
<context:component-scan base-package="org.ccf.roswell" />
...
The relevant lines in code are:
@Service("Repository")
public class RepositoryService implements org.ccf.roswell.repository.Repository
{
@Autowired(required=true)
private AccessControlDomain accessControlDomain=null;
...
There is a setter and getter for the property, but the documentation indicates that I can set the @Autowired on the field itself. When I do place the Autowired statement on the setter it makes no difference. All the beans load, but it's like the container completely ignores the Autowired annotation.
I was running this under 3.0.0M1, but switched to 2.5.6 to see if that made a difference. I'm not up to the point that I need the features of 3.0.0M1 yet. I've included all the dependent Jar files I can identify. Is there something that I'm missing to trigger Autowiring?


Reply With Quote

