Remnart

we love me
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

SPRING和JDK的注解

Posted on 2017-07-31 09:06  Remnart  阅读(168)  评论(0编辑  收藏  举报

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 在一个类中注入域属性