[cdi-dev] passivation capable parameters for producerMethods

Pete Muir pmuir at redhat.com
Thu Jun 30 03:07:32 EDT 2011

On 29 Jun 2011, at 13:57, Mark Struberg wrote:

> Hi!
> Section 6.6.4 declares that:
>> If a producer method declares a passivating scope and:
>> ..
>> * has a parameter that does not resolve to a passivation capable 
>> dependency, 
>> then the container automatically detects the problem and 
>> treats it as a deployment problem.
> What is the reason for this restriction?

Not 100% sure. Any one else know?

> Something like
> @Produces @SessionScoped @AutoAuthenticated
> public User getCurrentUser(EntityManager em) {
>   return ...
> (EntityManager gets produced as @RequestScoped) would not be allowed because EntityManager is not Serializable.

Actually as long as you use a resource producer field then the CDI container must make it passivation capable ;-) But that just makes it a bad example, it doesn't solve the problem.

More information about the cdi-dev mailing list