I have a following domain object called UserImpl
@Configurable
public class UserImpl implements User{
@Autowired
private UserManagementService _userService;

@Autowired
private GroupManagementService _groupService;

}

and two services:
@Component
public class UserManagementServiceImpl implements UserManagementService{
public UserManagementServiceImpl() {
System.out.println("UserManagementServiceImpl");
}
}

@Component
public class GroupManagementServiceImpl implements GroupManagementService{
public GroupManagementServiceImpl() {
System.out.println("GroupManagementServiceImpl");
}
}

I am using 2.1M2 and Maven2 and cannot use LTW..so i have a maven pom which includes the aspectj plugin and i am weaving my artifact with spring-aspects.jar

my test case is really simple:

public void testCreateUserDomainObjectAndTestServicesNotNull() {
UserImpl user = new UserImpl();
Assert.assertNotNull(user.getUserManagementService ());
Assert.assertNotNull(user.getGroupManagementServic e());
}

when I run this test, it fails and I get a warning message:

0 [main] WARN org.springframework.beans.factory.aspectj.Annotati onBeanConfigurerAspect - BeanFactory has not been set on [org.springframework.beans.factory.aspectj.Annotati onBeanConfigurerAspect]: Make sure this configurer runs in a Spring container. For example, add it to a Spring application context as an XML bean definition.


my spring configuration file looks like this:

<?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:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schem...ng-jee-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schem...g-util-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.1.xsd">

<aop:spring-configured/>
<context:annotation-config/>
<context:component-scan base-package="org.mypackage"/>

</beans>


Can you guys please tell me what I am missing to get this to work??

Thanks alot!