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/> 标签来 ...
随机推荐
- DDMS 使用方法
一.真机调试的两个必备条件 (1)手机打开开发者模式并且运行USB调试 (2)PC上装好手机对应的驱动 二.DDMS(DalvikDebugMonitorServer)四个主要窗口 Devices:当 ...
- 103. Binary Tree Zigzag Level Order Traversal (Tree, Queue; BFS)
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to ...
- 188. Best Time to Buy and Sell Stock IV (Array; DP)
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- Shell教程 之字符串
1.Shell字符串 字符串是shell编程中最常用最有用的数据类型(除了数字和字符串,也没啥其它类型好用了),字符串可以用单引号,也可以用双引号,也可以不用引号. 1.1 单引号 str='I am ...
- Balanced Numbers (数位DP)
Balanced Numbers https://vjudge.net/contest/287810#problem/K Balanced numbers have been used by math ...
- dUMP:A new value is to be assigned to the field "<L_BOX>"
DUMP: A new value is to be assigned to the field "<L_BOX>", although this field is e ...
- python脚本删除文件与目录的命令
1. 删除文件的命令 import os os.remove(file) os.unlink(file) 2.删除目录的命令 import shutil shutil.rmtree(directory ...
- java_11接口
1接口的概念 接口是功能的集合,同样可看做是一种数据类型,是比抽象类更为抽象的”类”. 接口只描述所应该具备的方法,并没有具体实现,具体的实现由接口的实现类(相当于接口的子类)来完成.这样将功能的定义 ...
- linux命令学习之:chown
chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户ID:组可以是组名或者组ID:文件是以空格分开的要改变权限的文件列表,支持通配符.系统管理员经常使用chown命令,在将文件拷贝 ...
- 操作符offset
操作符offset在汇编语言中是由编译器处理的符号,它的功能是取得标号的偏移地址. assume cs:codesg codesg segment start: mov ax, offset star ...