Breaking change in Accounts
by Juraci Paixão Kröhling
If you use "@Inject Persona" or "@Inject @CurrentUser HawkularUser",
keep reading.
If all you consume from Accounts are the Services ("@Inject
PermissionChecker" or "@Inject BlaService"), you are not affected.
Still, you should update to Accounts 2.0.2.Final.
On Accounts code, I was mis-using a behavior of WF8/WF9, where it was
possible to inject request-related beans into stateless beans. More
concretely, I was able to inject the persona for the current request
into a SLSB. With WF10, the bean pooling is now enabled by default,
meaning that beans created for a persona are pooled and re-used on
future requests. In this case, user "X" would make a request and the
bean would see it as being from user "Y".
This is being fixed in Accounts 2.0.2.Final, which also comes with the
update to WF 10.
Unfortunately, I could not find a reasonable workaround for current
consumers of Accounts that are using direct injection, so, you'll need
to change your code.
From:
@Inject Persona persona;
@Inject @CurrentUser HawkularUser user;
To:
@Inject Instance<Persona> personaInstance;
@Inject @CurrentUser Instance<HawkularUser> userInstance;
If your component has no changes required to work on WF 10, let me know
and I'll send a PR for this change. Otherwise, please incorporate such
change when changing your code to work on WF 10.
Code changes are required *only* is you use direct injection. If you get
the current persona via PersonaService#getCurrent, you should just
update to Accounts 2.0.2.Final.
- Juca.