web程序分层架构
浏览器发送请求--web层(controllor)--调用service层--调用数据访问层(dao)--data
自动装配之----
定义组件
- @Component spring 识别对象
- @Autowired自动注入;@Autowired(required=false)
定义装配歧义性
- @Qualifier("userServicenormal") 或者@primary: 同名类指定。
定义配置
- 设置组件扫描的基础包:@ComponentScan("包名") 也可以用xml文件扫描。
- @Configuration 表示这个文件是配置文件
分层架构定义组件
- @Controller
- @Service
- @Repository
spring测试环境
- @RunWith
- @ContextConfiguration
xml装配之----
注入方法:构造函数依赖注入<constructor-arg>元素;c-空间。
属性注入:property;p-名称空间。
复杂数据结构的表示方法:set,map,list...
spring框架
原文:https://www.cnblogs.com/pompeiipbb/p/11403778.html