Suppose I have a JSF bean with @PostConstruct method.
I would like to know which entity referenced the current bean and caused its initialization.
@PostConstruct
public void init() {
logger.info(... Who initialized me? ...);
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This information is not available in the JSF context. If you’re using Mojarra, you’d need to run the debugger and put a breakpoint on
ManagedBeanBuilder#bake()method.Or if you need this information during runtime for some unobvious reason, then you’d need to let the caller set itself in the setter of the
@ManagedPropertyreferencing the bean.then you can gather this information in the
setParent()method.