随笔分类 - Spring
摘要:一、Spring 中的常见注解。 1、声明 Bean 的注解。 @Component:该注解是一个泛化概念,仅仅表示一个组件对象(Bean),没有明确的角色。 @Repository:该注解用于数据访问层(DAO)的类标识符为Bean,即注解数据访问层Bean,其功能与@Component()相同。
阅读全文
摘要:AOP面向切面配置:1、context:component-scan:扫描包路径下的所有类注解。 <!-- 指定扫描com.sfwu15.bean包下的所有类的注解 注意:扫描包时,会扫描所有包下的子孙包 --> <context:component-scan base-package="com.s
阅读全文
摘要:创建目标类。 public class UserDaoImpl implements UserDao { public void save() { System.out.println("保存用户!"); } public void select() { System.out.println("查询
阅读全文