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

Daniel Sachse sachsedaniel at gmail.com
Tue Oct 9 15:56:32 EDT 2012


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 @interface Mock {}


@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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20121009/7491f4d6/attachment.html 


More information about the cdi-dev mailing list