zoukankan      html  css  js  c++  java
  • Spring注解备忘

    记录一下目前知道的注解

    1、使用 @Configuration 注释告诉 Spring,这是核心的 Spring 配置文件,并通过 @Bean 定义 bean。
    2、@Import 导入多个@Configuration

    3、@Scope("prototype")定义bean的作用域

    4、@Required确保值被设置

    5、@Value直接注入

    6、@Component,@Service,@Controller,@Repository注解的类,并把这些类纳入进spring容器中管理。
    @Service用于标注业务层组件
    2、@Controller用于标注控制层组件(如struts中的action)
    3、@Repository用于标注数据访问组件,即DAO组件.
    4、@Component泛指组件,当组件不好归类的时候,我们可以使用这个注解进行标注。

    7、常见AspectJ的注解:
    @Aspect
    @Before – 方法执行前运行
    @After – 运行在方法返回结果后
    @AfterReturning – 运行在方法返回一个结果后,在拦截器返回结果。
    @AfterThrowing – 运行方法在抛出异常后,
    @Around – 围绕方法执行运行,结合以上这三个通知。

    8、@transactional使得方法具有事务特性
    9、@RequestHeader get请求或post都有请求头,用@RequestHeader注解来获取。

  • 相关阅读:
    Centos下安装部署redis
    mysql 事务操作
    python 基础杂货铺
    6、Django 第三方工具
    5、Django
    4、django 模板
    RPC框架--missian框架
    jvm详情——7、jvm调优基本配置、方案
    jvm详情——6、堆大小设置简单说明
    jvm详情——5、选择合适的垃圾收集算法
  • 原文地址:https://www.cnblogs.com/encode/p/5912014.html
Copyright © 2011-2022 走看看