@Retention(value=RUNTIME) @Target(value=METHOD) public @interface AfterConstruct
A method annotated with this annotation will be invoked after the controller is constructed. The method can take no arguments. An @AfterContruct method will not be intercepted if it, or its class, is annotated with @InterceptedBy. Any servlet resources, such as HttpServletRequest, HttpServletResponse, and HttpSession, annotated with @Inject will not have been injected when the method is called, but other fields annotated with @Inject will have been injected. A method annotated with this annotation must be public, and there can be only one occurrence in a class.
An @AfterContruct method can be used in controllers only. Currently,
interceptors cannot have methods annotated with this annotation. Typically,
this annotation will be used together with the Init
annotation, so
that users can perform their own activities during application
initialization. For example, consider the following controller:
@Init @SingletonController public class InitController { @AfterConstruct public void init() { // do some application-specific initialization } }
Copyright © 2011-2012 MojaveMVC.org