注意:在使用 @Autowired时不要将类静态化,即不要加static
1、在applicationContext.xml中扫描该类的包
<context:component-scan base-package="com.suning.web.service"/>
<bean id="getPerson" class="com.suning.web.service.PsInfoService"/>
然后再其他类只要像下面这样既可装配:
@Autowired
private PsInfoService csInfoService;
并且
PsInfoService中不用@component注释
2、