@Autowired 注解一<context:component-scan base-package=" "> 开启包扫描 注解二<context:annotation-config>开启注入注解扫描 一般情况下,两个注解不一起使用. 当"注解一",扫描含有注解@Component/@Service等的类时,注入注解自动生效就不需要配置注解二了 当要扫描的类上没有含有@Component/@Service等注解时,注入注解没有生效,那么只需要添加注解二即可 |
|
来自: liang1234_ > 《spring》