Sprign中常用注解
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中常用注解的更多相关文章
- spring注解开发中常用注解以及简单配置
一.spring注解开发中常用注解以及简单配置 1.为什么要用注解开发:spring的核心是Ioc容器和Aop,对于传统的Ioc编程来说我们需要在spring的配置文件中邪大量的bean来向sprin ...
- SpringBoot 中常用注解
本篇博文将介绍几种SpringBoot 中常用注解 其中,各注解的作用为: @PathVaribale 获取url中的数据 @RequestParam 获取请求参数的值 @GetMapping 组合注 ...
- SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍
SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍 本篇博文将介绍几种如何处理url中的参数的注解@PathVaribale/@Requ ...
- SpringBoot 中常用注解@Controller/@RestController/@RequestMapping的区别
SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别 @Controller 处理http请求 @Controller //@Re ...
- SpringBoot 中常用注解@Controller/@RestController/@RequestMapping介绍
原文 SpringBoot 中常用注解 @Controller/@RestController/@RequestMapping介绍 @Controller 处理http请求 @Controller / ...
- Spring 中常用注解原理剖析
前言 Spring 框架核心组件之一是 IOC,IOC 则管理 Bean 的创建和 Bean 之间的依赖注入,对于 Bean 的创建可以通过在 XML 里面使用 <bean/> 标签来配置 ...
- spring 以及 spring mvc 中常用注解整理
spring 以及 spring mvc 中常用注解整理 @RequestMapping(映射路径) @Autowired(注入 bean 对象) 例如: @Autowired private Bas ...
- SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别
@Controller 处理http请求 @Controller //@ResponseBody public class HelloController { @RequestMapping(valu ...
- 0000 - Spring 中常用注解原理剖析
1.概述 Spring 框架核心组件之一是 IOC,IOC 则管理 Bean 的创建和 Bean 之间的依赖注入,对于 Bean 的创建可以通过在 XML 里面使用 <bean/> 标签来 ...
随机推荐
- e-olymp Problem4196 Chocolate bars
吐槽一下,这个OJ的题目真的是阅读理解题.代码非常短,就是题目难理解.心累. 传送门:点我 Chocolate bars It is hard to overestimate the role of ...
- linux同步机制2
一.并发控制(1)自旋锁得不到资源,会原地打转,直到获得资源为止定义自旋锁 spinlock_t spin;初始化自旋锁 spin_lock_init(lock);获得自旋锁spin_lock(loc ...
- css定位研究
css的定位是很重要的一个知识点,要学会网页布局,一定要先把定位弄清楚,今天抽空整理一下这方面的知识. 1.块级元素和行内元素(内联元素) 块级元素:display值为block的元素就是块级元素,比 ...
- Js或 Activex 控件调用打印预览等操作
<input value="打印" type="button" onclick="javascript:window.print()" ...
- linux操作Mysql数据库基本命令
1.显示数据库 show databases; 2.选择数据库 use 数据库名; 3.显示数据库中的表 show tables; 4.显示数据表的结构 describe 表名; 5.显示表中记录 S ...
- Ubuntu防火墙配置
转载自:http://blog.csdn.net/sumer0922/article/details/7485584Ubuntu11.04默认的是UFW(ufw 即uncomplicated fire ...
- 33-Java中的String,StringBuilder,StringBuffer三者的区别
转载自:https://www.cnblogs.com/su-feng/p/6659064.html StringBuilder 详解 (String系列之2) Java中的String,String ...
- 字符串加u的特殊需求
#coding:utf-8 L = ['a','b','c'] S = [] for i in L: tmp = str(i).decode('utf-8') S.append(tmp) print ...
- sap 给集团分配一个逻辑系统
1.进入事务代码 SALE定义一个新的逻辑系统 2.通过事务代码RZ10 进入之后, 将参数login/no_automatic_user_sapstar 修改为“0”, 然后重启SAP服务生效 3. ...
- jquery字符串相等判断
在jquery中字符串相等判断一直失败 原来是空格! string1, string2 若其中有一个为返回值或类似 $.trim(string1) == $.trim(string2) ------- ...