2020java框架教程之spring第二章总结

2020java框架教程之spring第二章总结

定义配置:

@Configuration
@ComponentScan(注解扫描)

定义组件:

@Component
@Autowired(自动装配)
@Autowired(required=false)

自动装配歧义性

@Primary
@Qualifier
@Resource

分层架构中定义组件

@Controller
@Service
@Repository

spring测试环境

@Runwith
@ContextConfiguration

使用XML启用组件扫描

<context:component-scan base-package=”包名” />

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *