1、@Component 创建类对象,相当于配置<bean/>

2、@Service 与 @Component功能相同

  2.1写在ServiceImpl类上  (建议在ServiceImpl类使用)

3、@Repository 与 @Component 功能相同

  3.1 写在数据访问层类上

4、@Controller 与 @Component 功能相同

  4.1 写在控制器类上

上面四个可以相互转换的

5、@Resource(不需要写对象的get/set)

  5.1 java中的注解

  5.2 默认按照ByName注入,如果没有名称对象,按照ByType注入

    5.2.1 建议把对象名称和spring容器中对象名相同

6、@Autowired(不需要写对象的get/set)

  6.1 spring的注解

  6.2 默认按照ByType注入

7、@Value() 获取properties 文件内容

8、@Pointcut() 定义切点

9、@Aspect() 定义切面类

10、@Before() 前置通知

11、@After 后置通知

12、@AfterReturning 后置通知,必须切点正确执行

13、@AfterThrowing 异常通知

14、@Arround 环绕通知

Sprign中常用注解的更多相关文章

  1. spring注解开发中常用注解以及简单配置

    一.spring注解开发中常用注解以及简单配置 1.为什么要用注解开发:spring的核心是Ioc容器和Aop,对于传统的Ioc编程来说我们需要在spring的配置文件中邪大量的bean来向sprin ...

  2. SpringBoot 中常用注解

    本篇博文将介绍几种SpringBoot 中常用注解 其中,各注解的作用为: @PathVaribale 获取url中的数据 @RequestParam 获取请求参数的值 @GetMapping 组合注 ...

  3. SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍

    SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍 本篇博文将介绍几种如何处理url中的参数的注解@PathVaribale/@Requ ...

  4. SpringBoot 中常用注解@Controller/@RestController/@RequestMapping的区别

    SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别 @Controller 处理http请求 @Controller //@Re ...

  5. SpringBoot 中常用注解@Controller/@RestController/@RequestMapping介绍

    原文 SpringBoot 中常用注解 @Controller/@RestController/@RequestMapping介绍 @Controller 处理http请求 @Controller / ...

  6. Spring 中常用注解原理剖析

    前言 Spring 框架核心组件之一是 IOC,IOC 则管理 Bean 的创建和 Bean 之间的依赖注入,对于 Bean 的创建可以通过在 XML 里面使用 <bean/> 标签来配置 ...

  7. spring 以及 spring mvc 中常用注解整理

    spring 以及 spring mvc 中常用注解整理 @RequestMapping(映射路径) @Autowired(注入 bean 对象) 例如: @Autowired private Bas ...

  8. SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别

    @Controller 处理http请求 @Controller //@ResponseBody public class HelloController { @RequestMapping(valu ...

  9. 0000 - Spring 中常用注解原理剖析

    1.概述 Spring 框架核心组件之一是 IOC,IOC 则管理 Bean 的创建和 Bean 之间的依赖注入,对于 Bean 的创建可以通过在 XML 里面使用 <bean/> 标签来 ...

随机推荐

  1. CentOS7中编译安装redis5.0

    1. 环境介绍 CentOS7 (未安装Development Tools) 2. 下载Redis5.0-rc3 wget -O redis-5.0-rc3.tar.gz https://github ...

  2. 食物链(带权&种类并查集)

    食物链 http://poj.org/problem?id=1182 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9326 ...

  3. cross-env:跨平台设置和使用环境变量

    一 项目结构 二 安装依赖 npm install --save-dev cross-env 三 npm脚本 { "name": "demo", "v ...

  4. Mac电脑Dock栏开启放大特效

    1 右击Dock栏空白处,选择启用放大 2 在Dock偏好设置中调整图标放大的倍数 3 滑动鼠标,查看放大效果

  5. 100-days:nine

    Title: Boeing(波音飞机) crash isolates FAA as(伴随,随着) China leads push against Max(出事机型,即737 Max) crash n ...

  6. bootstrap-table 使用遇到的问题总结

    问题一:右上角button样式自定义 方法: //修改bootstrap-table右上角按钮样式 $(".table-box .columns-right button").re ...

  7. swift - 基础属性 - 属性写法

    var num1 : Int = 0 var num2 : Int = 5 /// 1.计算属性 var num3 : Int{ return num1 + num2 } /// 2.闭包属性 pri ...

  8. java 线程Thread 技术--线程方法详解

    Thread 类常用的方法与Object类提供的线程操作方法:(一个对象只有一把锁

  9. SideBar 选择城市时右侧边上的 选择bar

    需要定义一个SideBar的视图类  在布局文件中引用   同时在布局中设置一个textView默认不可见 当触摸时才显示   在调用的Activity中 sideBar.setOnTouchingL ...

  10. transaction注解分析

    1. Spring事务的基本原理 事务管理是应用系统开发中必不可少的一部分.Spring 为事务管理提供了丰富的功能支持.Spring 事务管理分为编码式和声明式的两种方式.编程式事务指的是通过编码方 ...