On 2/24/13 2:06 PM, Olaf Krische wrote:
> Hello,
>
> by the way, about injection, is there an tutorial out there on how to
> bind custom component providers to Resin's CDI? For example, i use
> picocontainer and i would like to have Resin ask picocontainer as well
> (mostly singletons)
>
> For Jersey, which also uses Injection, i have created a bridge, so that
> it can ask picocontainer, which is stored in the servlet context.

@Produces is probably what you need. You can create a factory/bridge class
to return CDI objects. Resin itself does this for the predefined objects.

@Singleton
public class MyFactory {  // it doesn't have to be a @Singleton, but 
probably would be
   @Produces
   public static MyObject _myField; // you can use static methods

   @Produces
   public MyObject myBuilder() { ... } // or methods (I'd prefer methods)
}

MyFactory would need to know how to get the picocontainer objects.

-- Scott

>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to