@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注释用于需要执行的方法在依赖注入完成后执行任何初始化.这个方法必须在类投入服务之前调用. 这个所有支持依赖关系 ...
随机推荐
- CodeForces 327C
Magic Five Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit ...
- TCP/IP协议族(一) HTTP简介、请求方法与响应状态码
接下来想系统的回顾一下TCP/IP协议族的相关东西,当然这些东西大部分是在大学的时候学过的,但是那句话,基础的东西还是要不时的回顾回顾的.接下来的几篇博客都是关于TCP/IP协议族的,本篇博客就先简单 ...
- 消费创富会开发模式系统App
消费创富会系统定制开发,消费创富会网页开发模式,消费创富会开发软件,消费创富会系统APP开发,消费创富会平台模式开发,专业开发微信商城分销.公排.全返.分红.互助等模式定制开发,APP.网页版.微信端 ...
- C#中let字句
应用场景: 在查询表达式中,存储子表达式的结果有时很有用,这样可以在随后的子句中使用. 可以使用 let 关键字完成这一工作,该关键字可以创建一个新的范围变量,并且用您提供的表达式的结果初始化该变量. ...
- 如何用webbrowser获取ajax动态生成的网页的源码?
1.步骤一:修改IE内核的版本(这个方法厉害了) public Form1() { InitializeComponent();int BrowserVer, RegVal; // get the i ...
- (@WhiteTaken)设计模式学习——抽象工厂模式
抽象工厂模式,可以向客户端提供一个接口,而客户端不用指定具体的类型创建对象,却能够创建多个产品族(一类具有共性产品,如地域等)的对象. 下面直接上代码. 1.苹果需要实现水果的接口,而苹果可以有北方的 ...
- 基于Ubuntu14.04-LTS下安装docker
1.sudo apt-get update --更新系统源 2.sudo apt-get install docker.io 3.将docker库的公钥中加入到本地apt中 sudo apt-key ...
- 匹配PC和移动端
方法1: var browser={ versions:function(){ var u = navigator.userAgent, app = navigator.appVersion; ret ...
- 一篇知乎的故事 - javascript技术贴
前言 就像文章题目所示,本文的发表源于知乎的一篇文章.文章链接如下:如果你想靠前端技术还房贷,你不能连这个都不会.这篇文章是群里水群时别人发的,像我这样的菜鸟角色才不会逛知乎~~~.这篇文章主要是讲了 ...
- CREELINKS平台_处理器CeGpio资源使用说明(CeGpio的配置与使用)
0x00 CREELINKS平台简介 CREELINKS(创e联)是由大信科技有限公司研发,集合软硬件.操作系统.数据云储存.开发工具于一体,用于物联网产品的设计.研发与生产的平台. 平 ...