zoukankan      html  css  js  c++  java
  • Spring中常用注解

    1.@Component

      创建类对象,相当于配置<bean/>

    2.@Service

      @Service与@Component功能相同,写在ServiceImpl类上

    3.@Repository

      @Repository与@Component功能相同,写在数据访问层类上

    4.@Controller

      @Controller与@Component功能相同,写在控制器类上

    5.@Resource

      java中的注解

      默认按照byName注入,如果没有名称对象,按照byType注入

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

      不需要写对象的get/set方法

    6.@Autowired

      spring中的注解

      默认按照byType注入

      不需要写对象的get/set方法

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

    8.@Pointcut()  定义切点

    9.@Aspect()    定义切面类

    10.@Before()  前置通知

    11.@After()     后置通知

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

    13.@AfterThrowing()   异常通知

    14.@Arround()       环绕通知

      

  • 相关阅读:
    junit4的初级用法
    junit3和junit4的区别总结
    工作一年多了,我的技术博客终于开通了
    VC++ 运行库官方安装包
    文本编辑器通用快捷键
    gcc命令介绍
    MinGW安装与配置
    windows常见快捷键
    Notepad++配置C/C++
    Notepad++快捷键
  • 原文地址:https://www.cnblogs.com/mxj961116/p/11271888.html
Copyright © 2011-2022 走看看