[cdi-dev] Unexplained change in behavior between Java EE 6 and Java EE 7
Steve Millidge
smillidge at c2b2.co.uk
Mon Dec 8 12:08:51 EST 2014
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<http://www.c2b2.co.uk/> | E: smillidge at c2b2.co.uk<mailto:smillidge at c2b2.co.uk>
[Main SIgnature May 14]
---------------------------------------------------------------------------------------------------------------
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20141208/973db343/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 20712 bytes
Desc: image001.jpg
Url : http://lists.jboss.org/pipermail/cdi-dev/attachments/20141208/973db343/attachment-0001.jpg
More information about the cdi-dev
mailing list