[cdi-dev] Problem with EJB´s, Stereotype with an @Alternative and Specialization

Martin Kouba mkouba at redhat.com
Wed Oct 10 03:56:09 EDT 2012


Hi Daniel,

this is a known Weld issue:
https://issues.jboss.org/browse/WELD-1138

In fact stereotypes did not work for session beans at all. It's already fixed/backported in 1.1.9.Final, 1.2.0.Beta1 and 2.0.0.Alpha3.

Please use the Weld forums for additional info...

Martin

Dne 9.10.2012 21:56, Daniel Sachse napsal(a):
> Hey guys,
>
> I ran into a problem today and I am unsure if the behavior I encountered is the way it should be.
>
> My Environment:
> JBoss 7.1.1.Final with Weld 1.1.5
>
> My Scenario:
>
> ------------------------------------------------------------------------------------------------------
> public abstract class AbstractClass implements DemoInterface {…}
>
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> public class Real extends AbstractClass {…}
>
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> @Alternative
> @Specializes
> public class Mock extends Real {…}
>
> ------------------------------------------------------------------------------------------------------
>
> If I register class Mock as an @Alternative in beans.xml, everything works fine.
>
> <alternatives>
> <class>at.w0mb.example.Mock</class>
> </alternatives>
>
> As soon as I try:
>
> ------------------------------------------------------------------------------------------------------
>
> @Alternative
> @Stereotype
> @Retention(RUNTIME)
> @Target(TYPE)
> public at interfaceMock{}
>
>
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> @Mock
> //@Alternative
> @Specializes
> public class Mock extends Real {…}
>
> ------------------------------------------------------------------------------------------------------
>
> If I now register the @Stereotype Mock as an @Alternative in beans.xml, the application won´t deploy.
> <alternatives>
> <stereotype>at.w0mb.example.stereotype.Mock</stereotype>
> </alternatives>
>
> The thrown error message is:
> WELD-001408 Unsatisfied dependencies for type [DemoInterface] …….
>
>
> Do you guys think that this is normal? Is it a specification Issue? Or Weld?
>
> Regards,
>
> Daniel
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>



More information about the cdi-dev mailing list