We have decided that all our modular code should use JSR-330 dependency injection and we have used Guice 2.1SVN or Java EE 6 CDI to do the actual injection in several projects and has worked very well.
We have one remaining scenario where I need to find a solution, namely that we have an embedded web container running on Java 5 where I would like to be able to deploy WAR-files using JSR-330 injection like in Java EE 6.
I have found that GlassFish and Resin 4 can do this, but the Java EE 6 web profile is simply too large for this purpose as we run quite small applications each in their own embedded server.
Hence the question is, does there exist a web container with native JSR-330 support easily available so we can deploy our existing code into it (compiled for Java 5) without having the full Weld or the G开发者_如何学Pythonuice-servlet enclosed in the WAR. It is perfectly fine to have a full configuration suite placed in the main code invoking the web container, but I don't want any guice/Spring/weld jars in the actual web application deployment.
Have you considered using Jetty 6 or 7 Embedded? It's open source and supported by Eclipse, so will have a long lifetime of support. I use it all the time with Spring for DI and find it extremely lightweight. Ideal for rapid, iterative development.
Your question specifies no Guice, Spring or Weld jars in the actual application. Jetty allows configuration of different classpaths, so you can include the necessary support implementations of JSR-330 as required.
精彩评论