How to enable CDI inject in web service (jaxrs/jersey) on java se running grizzly?

After seeing this stackoverflow post, I implemented the following solution. Not sure if it is the best route to take, but it worked. I created an hk2 Binder and registered the Binder: public class WebServiceBinder extends AbstractBinder { @Override protected void configure() { BeanManager bm = getBeanManager(); bind(getBean(bm, StudentRepository.class)) .to(StudentRepository.class); } private BeanManager getBeanManager() { … Read more

Inject and Resource and Autowired annotations

The difference between @Inject vs. @Autowire vs. @Resource? @Autowired: spring propriety annotation (as opposed to @Inject and @Resource) that inject a resource by-type, i.e. by the class of by the interface of the annotated field or contractor. In case we have few implementation of an interface or a subclass we can narrow down the selection … Read more

How to create a modular JSF 2.0 application?

I understand that your question basically boils down to How can I include Facelets views in a JAR? You can do this by placing a custom ResourceResolver in the JAR. public class FaceletsResourceResolver extends ResourceResolver { private ResourceResolver parent; private String basePath; public FaceletsResourceResolver(ResourceResolver parent) { this.parent = parent; this.basePath = “/META-INF/resources”; // TODO: Make … Read more