Posted under CDI & Spring
Permalink
Tags Tip
I came across a Spring Boot app which clearly used Spring for its IOC (@Configuration classes defining Spring Beans with @Bean)
The app also used @Inject/javax.inject which initially led me to think it was using CDI/Weld, i.e. was using 2 IOC frameworks.
However, Spring also supports the basic Java EE annotations via JSR-330. JS-299 is the full CDI/Weld spec, but there was robust debate about Spring taking on board the full JSR-330 spec, and in the end they just went for a small subset which became JSR-299.
This includes among other things @Inject, so this can be used as a synonym for @Autowired.
Adam Bien describes the difference between JSR-299 and JSR-330 very well in this post here.
This blog post by David Kessler describes and investigates the use of both in code very well.
Leave a Reply
You must be logged in to post a comment.