Using CDI without a Servlet Container

落花浮王杯 提交于 2019-12-12 08:29:27

问题


I want to write a simple Java Desktop Application using Java Swing. Usually I use Spring Framework to do the dependency injection and build the whole class structure. However, I've seen that CDI is becoming more and more popular and want to give it a try.

I would like to do the Dependency Injection of my project using CDI, but I don't know if this is possible without a Servlet container (as it is using Spring). Every single tutorial seems to be related with servlet containers or application servers.


回答1:


You don't need a container: A very short tutorial can be found here: http://randling.wordpress.com/2011/08/15/cdi-in-java-se/



来源:https://stackoverflow.com/questions/17989771/using-cdi-without-a-servlet-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!