spring Annotation 组分注塑
spring 注意分类
启动spring自己主动扫描功能
<context:component-scan/>
1.@Repository:
它用于将数据訪问层 (DAO 层 ) 的类标识为 Spring Bean。详细仅仅需将该注解标注在 DAO 类上就可以。
为什么 @Repository 仅仅能标注在 DAO 类上呢?
这是由于该注解的作用不仅仅是将类识别为 Bean,同一时候它还能将所标注的类中抛出的数据訪问异常封装为 Spring 的数据訪问异常类型。 Spring 本身提供了一个丰富的而且是与详细的数据訪问技术无关的数据訪问异常结构,用于封装不同的持久层框架抛出的异常,使得异常独立于底层的框架。
2.@Component :
@Component 是一个泛化的概念,只表示一个组件 (Bean) ,能够作用在不论什么层次。
3.@Service:
@Component 是一个泛化的概念,只表示一个组件 (Bean) ,能够作用在不论什么层次。
4.@Controller:
@Service 它通常是在业务层上施加,但是,现在这个功能 @Component 相同。
spring Annotation 组分注塑的更多相关文章
- Spring Annotation Processing: How It Works--转
找的好辛苦呀 原文地址:https://dzone.com/articles/spring-annotation-processing-how-it-works If you see an annot ...
- Java 第六天 Spring Annotation 和其它
Annotation,是Java语言中的一种特殊的元数据语法,Spring支持使用annotation来进行对象实例化和装配 使用Annotation在Spring的配置xml中添加context命名 ...
- [转载]Spring Annotation Based Configuration
Annotation injection is performed before XML injection, thus the latter configuration will override ...
- Spring Annotation注解进行aop的学习
使用Maven管理项目,pom文件为: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" ...
- spring annotation功能备注
@Autowired @Autowired 注释可以在 setter 方法中被用于自动连接 bean.以type方式进行匹配. 一个构造函数 @Autowired 说明当创建 bean 时,即使在 ...
- Spring Annotation(注解)
Spring Boot Annotation @SpringBootApplication 必须作用在main 方法所在类 @RequestMapping @GetMapping @PostMappi ...
- spring annotation简述
一.Annotation基本概念 Annotation是jdk5以后出现的新特性,在jdk中,其内置了许多自己的Annotation,例如@Override,@SuppresWarning,@Depr ...
- hibernate spring annotation setup
First step setup for the pom.xml with hibernate dependency , hibernate dependency need to before the ...
- spring Annotation 笔记2.1
使用注解替代xml 在前几章的笔记基础上添加使用注解的形式 1.配置applicationContext 添加context schema <?xml version="1.0&quo ...
随机推荐
- 在Android手机上获取其它应用的包名及版本
转载请注明出处:http://blog.csdn.net/jason_src/article/details/37757661 获取Android手机上其它应用的包名及版本方法有非常多,能够通过AAP ...
- JAVA 实现发牌的 改进
java是一门面向对象的语言,我们在解决这个问题的时候先找对象.我认为面想对象 “就是把复杂的问题变简单,简单的问题程序化” .如果我们 创建一盒牌--->洗牌--->选地主牌---&g ...
- Linux编译多个不同目录下的文件以及静态库、动态库的使用
先看两篇博文,作为基础知识.如果对C/C++编译链接过程都了解的话,可以跳过不看. http://www.firedragonpzy.com.cn/index.php/archives/2556 ht ...
- mysql-5.6.13在windows平台下的安装、使用(图解)
本文同步至:http://www.waylau.com/mysql-5-6-13-windows-platform-installation-use-graphic/ 一. 首先电脑要具备.Net F ...
- ubuntu 安装maven提示出错 The program 'mvn' can be found in the following packages
问题: I am trying to install apache maven 3 in Ubuntu 12.04 lts. What I did was open the terminal then ...
- JavaScript编程:使用DOM操作样式表
6.使用DOM操作样式表: 操纵元素的Style样式属性: background-color:style.backgroundColor color:style.col ...
- 挑战一下吧!C#测试开发工程师英语面试题
1. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size o ...
- hdu1869 六度分离(Floyd)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1869 转载请注明出处:http://blog.csdn.net/u012860063?viewmode ...
- 【从零学习经典算法系列】分治策略实例——高速排序(QuickSort)
在前面的博文(http://blog.csdn.net/jasonding1354/article/details/37736555)中介绍了作为分治策略的经典实例,即归并排序.并给出了递归形式和循环 ...
- XMPPclient库Smack 4.0.6一个版本的开发
XMPPclient库Smack 4.0.6版开发之中的一个 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 一.Smack库概述 Smack是一个开源. ...