Spring注解和JDK注解

1.添加xsd约束

 

 

xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd

2. component:组件

<context:component-scan base-package=""></context:component-scan>
3.几种注解

@Component("info") 不分层
@Repository("info") dao
@Service("info") biz
@Controller("info") action

@Value() 在一个类中注入普通属性值

@Resource 在一个类中注入域属性

@Autowired 在一个类中注入域属性

 

posted on 2017-07-26 17:33  溜氓  阅读(330)  评论(0编辑  收藏  举报

导航