Hi
We are investigating a change in behaviour between Java EE 6 and Java EE 7 and were wondering if this is a bug or a specification change;
If there is a RequestScoped bean and SFSB like below, and I call invokeStatefulService() on the Request Scoped Bean the behaviour changes depending on Java EE version;
On GFv3 and JBoss EAP 6 the method returns "init" implying we have 2 separate SFSB instances.
and on GFv4 and WildFly the method returns "stateFromFirst" implying there is 1 SFSB instance.
I would’ve imagined that the second result i.e. 1 SFSB as there is 1 client bean which exists for the duration of the call is the correct behaviour. However I am not sure.
As both appservers above use JBoss Weld for CDI is this a Weld bug or did the behaviour change between Java EE 6 and Java EE 7?
@RequestScoped
public class Injection {
@Inject
StatefulService first;
@Inject
StatefulService second;
public String invokeStatefulService(){
first.setState("stateFromFirst");
return second.getState();
}
}
@Stateful
public class StatefulService {
private String state;
@PostConstruct
public void init(){
this.state = "init";
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
}
Steve Millidge
Director
C2B2
The Leading Independent Middleware Experts.
T: 08450 539457
|
M: 07920 100626
|
W:
www.c2b2.co.uk
|
E:
smillidge@c2b2.co.uk
---------------------------------------------------------------------------------------------------------------
C2B2 Consulting Limited,
Malvern Hills Science Park,
Geraldine Road,
Malvern,
Worcestershire,
WR14 3SZ
Registered in England and Wales: 4563419, Registered Office: Ardendale, Old Hollow, Malvern, Worcestershire