@PostConstruct 注解
@PostConstruct 注解
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/ package javax.annotation; import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*; /**
* The PostConstruct annotation is used on a method that needs to be executed
* after dependency injection is done to perform any initialization. This
* method MUST be invoked before the class is put into service. This
* annotation MUST be supported on all classes that support dependency
* injection. The method annotated with PostConstruct MUST be invoked even
* if the class does not request any resources to be injected. Only one
* method can be annotated with this annotation. The method on which the
* PostConstruct annotation is applied MUST fulfill all of the following
* criteria
- The method MUST NOT have any parameters except in the case of EJB
* interceptors in which case it takes an InvocationC ontext object as
* defined by the EJB specification.
* - The return type of the method MUST be void.
* - The method MUST NOT throw a checked exception.
* - The method on which PostConstruct is applied MAY be public, protected,
* package private or private.
* - The method MUST NOT be static except for the application client.
* - The method MAY be final.
* - If the method throws an unchecked exception the class MUST NOT be put into
* service except in the case of EJBs where the EJB can handle exceptions and
* even recover from them.
* @since Common Annotations 1.0
* @see javax.annotation.PreDestroy
* @see javax.annotation.Resource
*/
@Documented
@Retention (RUNTIME)
@Target(METHOD)
public @interface PostConstruct {
}
@PostConstruct 注解的更多相关文章
- @PostConstruct注解小结
1.在具体Bean的实例化过程中,@PostConstruct注解的方法,会在构造方法之后,init方法之前进行调用2.在项目中@PostConstruct主要应用场景是在初始化Servlet时加载一 ...
- springboot用@Autowired和@PostConstruct注解把config配置读取到bean变成静态方法
springboot用@Autowired和@PostConstruct注解把config配置读取到bean变成静态方法 @SpringBootApplication public class Sen ...
- 【spring源码分析】spring和@PostConstruct注解
@PostConstruct注解好多人以为是Spring提供的.其实是Java自己的注解. Java中该注解的说明:@PostConstruct该注解被用来修饰一个非静态的void()方法.被@Pos ...
- @PostConstruct和@PostConstruct 注解 及ehcache 缓存 执行过程 小记
@PostConstruct 和@PostConstruct 注解 从Java EE 5规范开始,Servlet中增加了两个影响Servlet生命周期的注解(Annotion):@PostConstr ...
- java的@PostConstruct注解
javax.annotation 注释类型 PostConstruct @Documented @Retention(value=RUNTIME) @Target(value=METHOD) publ ...
- Spring@PostConstruct注解和构造方法的调用顺序
先看下@PostConstruct的注解 * The PostConstruct annotation is used on a method that needs to be executed * ...
- @PostConstruct注解原理解析
所有文章 https://www.cnblogs.com/lay2017/p/11478237.html 正文 @PostConstruct注解使用简介 在了解一个东西的原理之前,我们得初步的懂得如何 ...
- 【String注解驱动开发】你了解@PostConstruct注解和@PreDestroy注解吗?
写在前面 在之前的文章中,我们介绍了如何使用@Bean注解指定初始化和销毁的方法,小伙伴们可以参见<[Spring注解驱动开发]如何使用@Bean注解指定初始化和销毁的方法?看这一篇就够了!!& ...
- 【Java注解】@PostConstruct 注解相关
不多逼逼,直接看注解上面的文档, @PostConsturct PostConstruct注释用于需要执行的方法在依赖注入完成后执行任何初始化.这个方法必须在类投入服务之前调用. 这个所有支持依赖关系 ...
随机推荐
- Backdoor CTF 2013: 电子取证 250
0x00 题目 h4x0r厌烦了你对他的城堡的所有攻击,所以他决定报复攻击你,他给你发来一封带有图片的邮件作为警告,希望你能找出他的警告消息:-) 消息的MD5值就是flag. 0x01 解题法1 给 ...
- Ceph QoS 初探(下)
作者:吴香伟 发表于 2017/01/24 版权声明:可以任意转载,转载时务必以超链接形式标明文章原始出处和作者信息以及版权声明 存储QoS是个可以做很大也可以做很小的特性.SolidFire认为将Q ...
- 一次Redis 的性能测试和问题
[我的问题]:请教个问题,我在本机搭建linux虚拟机+redis 3.2.6,然后在本机物理机上面测试虚拟机的redis性能,如下VM配置参数做测试,redis 的性能好像不算太好,问题待排查的两点 ...
- 《javascript个人理解,个人整理。》
万事开头难. 本人做前端工程师,已几年,没有特别大的,已文字方式去做总结. 前段时间,早已经想好,但是迟迟没有去下笔!好在现在陆陆续续的写下去. 我知道这是一个很大的工程,但是我还是想做下去,不为别的 ...
- xcode8 更新cocoapods
一.升级ruby环境,由于目前淘宝Ruby镜像升级有问题,所以使用了 http://rubygems-china.oss.aliyuncs.com 二.需要操作的步骤: 1.检查你的ruby源,终端输 ...
- Android Realm数据库使用指南
Android Realm数据库使用指南 Realm数据库, 目前有Java, Objective‑C, React Native, Swift, Xamarin的几种实现, 是一套用来取代SQLit ...
- ftp服务搭建
文件传输服务 主配置文件目录/etc/vsftpd/vsftpd.conf 首先安装ftp服务器 yum install vsftpd 默认存放文件的目录 /var/ftp/pub 匿名登陆 创建一 ...
- IBatis入门
iBatis 简介: iBatis 是apache 的一个开源项目,一个O/R Mapping 解决方案,iBatis 最大的特点就是小巧,上手很快.如果不需要太多复杂的功能,iBatis 是能够满足 ...
- springmvc 获取request 和 java路径分隔符 在windows 和linux 下自动判断的方法
//获取requert HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestA ...
- HTML第一课
<标签名 属性>内容</标签名> <标签/> 静态网页与动态网页的区别:是否从数据库提取数据相对路径跟绝对路径../代表高一级的 牛逼的空格< ...