Results 1 to 2 of 2

Thread: EJB @PostConstruct method being invoked twice

  1. #1
    Join Date
    May 2007
    Posts
    15

    Default EJB @PostConstruct method being invoked twice

    Hi,

    I'm using Spring 3.0 for DI in a SLSB EJB 3.0 bean.
    The bean has a @PostConstruct annotated method that appears to get invoked twice: once by the EJB container and once by Spring. Is this correct?

    Spring is bootstrapped using an interceptor like this:

    @Interceptors(SpringBeanAutowiringInterceptor.clas s)

    @PostConstruct
    public void init() {
    //...
    }

    I haven't explicitly registered any BeanPostProcessor classes.

    Is there a way to prevent the method being invoked multiple times?


    marko

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    If it is invoked twice it is constructed twice... Did you register the bean as a spring bean?
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •