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

原文地址:https://www.cnblogs.com/qjt970518--/p/7240944.html