1.注解分类
- 用于创建对象的:
作用和xml配置文件中的bean标签的作用相同
@Component
@Repository
@Service
@Controller - 用于注入数据的:
作用和xml配置文件中的bean标签内部的property标签的作用相同
@Autowired
@Qualifier
@Resource
@Value - 用于改变作用范围的:
作用和xml配置文件中的bean标签中的scope属性相同
@Scope - 用于生命周期的:
作用和xml配置文件中的bean标签使用int-method,destory-method作用是相同的
@PreDestory
@PostConstruct