JavaSpring常见注解总结

常见注解总结

定义配置:
@Comfiguration
@ComponentScan

定义组件:
@Component
@Autowired
@Autowired(required = false)

自动装配歧义性:
@Primary
@Qualifier
@Resource

分层架构中定义组件:
@Controller
@Service
@Repository

Spring测试环境:
@RunWith
@ContextConfiguration

使用xml启动组件扫描:
<context:component-scan base-package="……"/>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章