New to Spring, and trying to understand how the following example works:
ControllerA.java
package com.web;
@Controller
public class ControllerA {
@Autowired
private PeopleManager pMgr;
public ModelAndView get(Abilities abilities )
{
List<People> people = pMgr.loadPeople( ... );
....
}
}
PeopleManager.java
package com.service;
public interface WikiManager
{
List<People> loadPeople( ... );
}
PeopleManagerImpl.java
package com.service;
@Component
public class PeopleManagerImpl implements PeopleManager {
@Override
public List<People> loadPeople( ... ) {
....
}
}
ApplicationContext.xml
<?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:aop="http://www.springframework.org/schema/aop"
xmlns="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schem...ng-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="com" />
<aop:aspectj-autoproxy />
</beans>
I understand conceptually what should happen through the use of autowiring, but I just don't see how this example works? How does Spring know that PeopleManager is really PeopleManagerImpl? PeopleManger doesn't even have an annotated tag to indicate it should be auto instantiated by the component scan tag.
Any help would be appreciated to this newbie.
Thanks


="http://www.springframework.org/schema/p"
Reply With Quote