blob: ea767a5d9c13f649d1d95b5504783fa8f85b1d72 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>PostConstruct</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="PostConstruct";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/annotation/ManagedBean.html" title="annotation in javax.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/annotation/PreDestroy.html" title="annotation in javax.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/annotation/PostConstruct.html" target="_top">Frames</a></li>
<li><a href="PostConstruct.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li>Optional</li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Element</li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.annotation</div>
<h2 title="Annotation Type PostConstruct" class="title">Annotation Type PostConstruct</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface <span class="memberNameLabel">PostConstruct</span></pre>
<div class="block">The <code>PostConstruct</code> 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
<code>PostConstruct</code> must be invoked even if the class does
not request any resources to be injected. Only one
method in a given class can be annotated with this annotation.
The method on which the <code>PostConstruct</code> annotation is
applied must fulfill all of the following criteria:
<ul>
<li>The method must not have any parameters except in the case of
interceptors in which case it takes an <code>InvocationContext</code>
object as defined by the Interceptors specification.</li>
<li>The method defined on an interceptor class or superclass of an
interceptor class must have one of the following signatures:
<p>
void &#060;METHOD&#062;(InvocationContext)
<p>
Object &#060;METHOD&#062;(InvocationContext) throws Exception
<p>
<i>Note: A PostConstruct interceptor method must not throw application
exceptions, but it may be declared to throw checked exceptions including
the java.lang.Exception if the same interceptor method interposes on
business or timeout methods in addition to lifecycle events. If a
PostConstruct interceptor method returns a value, it is ignored by
the container.</i>
</li>
<li>The method defined on a non-interceptor class must have the
following signature:
<p>
void &#060;METHOD&#062;()
</li>
<li>The method on which the <code>PostConstruct</code> annotation
is applied may be public, protected, package private or private.</li>
<li>The method must not be static except for the application client.</li>
<li>The method should not be final.</li>
<li>If the method throws an unchecked exception the class must not be put into
service except in the case where the exception is handled by an
interceptor.</li></ul></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, Common Annotations 1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/annotation/PreDestroy.html" title="annotation in javax.annotation"><code>PreDestroy</code></a>,
<a href="../../javax/annotation/Resource.html" title="annotation in javax.annotation"><code>Resource</code></a></dd>
</dl>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/annotation/ManagedBean.html" title="annotation in javax.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/annotation/PreDestroy.html" title="annotation in javax.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/annotation/PostConstruct.html" target="_top">Frames</a></li>
<li><a href="PostConstruct.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li>Optional</li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Element</li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>