Using CDI without a Servlet Container

2019-04-06 02:31发布

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条回答
Rolldiameter
2楼-- · 2019-04-06 02:38

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/

查看更多
登录 后发表回答