Before we don't support it AFAIK, we support CDI integration but not
EJB one. Could be added but @Inject should work for EJB once a
beans.xml added


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-12-03 15:36 GMT+01:00 Alexander Wagner <[email protected]>:
> Hello TomEE-Comunity,
>
> could someone give me an explanation why it is possible to inject by @Inject
> but not by @EJB in a MBean?
>
> @javax.management.MBean
> @ApplicationScoped
> class MyMBean  {
>         @Inject MyService myserviceA;
>         @EJB    MyService myserviceB;
>
>         @ManagedOperation
>         public void test() {
>                 System.out.println(myserviceA); // prints the proxy
>                 System.out.println(myserviceB); // prints null
>         }
> }
>
> @Stateless class MyService {}
>
> My background is that I can use @Inject as long as my Stateless does not
> implements an interface:
>
> @Stateless class MyService implements MyInterface {}
>
> Maybe my understanding of CDI is here not deep enough, but for now I use
> normally @EJB e.g. if the EJB's implements an interface because with @Inject
> the EJB can not be resolved anymore.
>
> So for now I can not use the MyService with an interface in a MBean. Does
> someone has a tip what I am doing wrong?
>
> Best Regards
> Alexander Wagner
>

Reply via email to