一、创建对象的注解有四个目前无区别
@Component
@Controller
@Service
@Repository
还有一个类上面的注解@Scope(value="")
当value值等于prototype时创建多实例,
当value值等于singleton时创建单实例
默认为singleton
二、注入属性的注解有两个
@Autowired(按类型注入)
@Resource(name=”“)(按名称注入)
一、创建对象的注解有四个目前无区别
@Component
@Controller
@Service
@Repository
还有一个类上面的注解@Scope(value="")
当value值等于prototype时创建多实例,
当value值等于singleton时创建单实例
默认为singleton
二、注入属性的注解有两个
@Autowired(按类型注入)
@Resource(name=”“)(按名称注入)