Interceptor Class @PostConstruct Method Is Not Called on 12.2.1

(Doc ID 2328025.1)

Last updated on NOVEMBER 23, 2017

Applies to:

Oracle WebLogic Server - Version 12.2.1.0.0 and later
Information in this document applies to any platform.

Symptoms

The @PostConstruct method can't be invoked by Interceptopr class on 12.2.1. But same @PostConstruct method invoked on 10.3.6

When calling ejb test, Below output shown in 10.3.6 log, but missing on 12.2.1.
"
MyInterceptor init()@PostConstruct
"

Refer:

1. This is Interceptopr code

package com.aaron.test.interpretors;
import javax.annotation.PostConstruct;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

public class MyInterceptor {

public MyInterceptor(){
System.out.println("MyInterceptor()");
}

@PostConstruct
public void init(InvocationContext context) throws Exception {
System.out.println("MyInterceptor init()@PostConstruct");
context.proceed();
}

@AroundInvoke
public Object invoke(InvocationContext context) throws Exception {
System.out.println("MyInterceptor invoke()@AroundInvoke");
return context.proceed();
}

}

2. This is EJB code

import com.aaron.test.interpretors.MyInterceptor;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;

@Stateless
public class MyBean{

public MyBean(){
System.out.println("MyBean()");
}

@PostConstruct
public void init() {
System.out.println("MyBean init()@PostConstruct");
}

@Interceptors(value=MyInterceptor.class)
public void sale(){
System.out.println("MyBean sale()@Interceptors");
}
}

 

Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms