依赖注入:
当使用 注解时:
在功能类上 加注解 @Service
在使用功能类的bean上 加注解
@Service 加在类名上
@Autowired 加在 实例化对象上 表示注入到IOC容器中
@ComponentScan 自动扫描 注解类 注册为bean
最后在 annotationConfigApplicationContext 里加载 被@ComponentScan修饰的类
依赖注入:
当使用 注解时:
在功能类上 加注解 @Service
在使用功能类的bean上 加注解
@Service 加在类名上
@Autowired 加在 实例化对象上 表示注入到IOC容器中
@ComponentScan 自动扫描 注解类 注册为bean
最后在 annotationConfigApplicationContext 里加载 被@ComponentScan修饰的类