Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

General approach migrating from Spring Dependency Injection to CDI?

Alfred Swensen
Posts: 10
Netbeans IDE PHP VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I like to migrate an application from Java SE Spring Dependency-Injection using applicationContext-production.xml, applicationContext-devel.xml etc. files to Java EE CDI.

In Spring, I could include several configuration files with the jar and load one at application start (by parsing e.g. a command line parameter --config). So my first question is what would be the best practice to configure a "profile" in JavaEE? Can I somehow switch between web.xml.DEVEL and web.xml.PROD before the CDI dependency injection kicks in?

As I configured not only member objects (@Inject) but also attribute values (@Resource), I would not only have to switch between different beans.xml for different <alternatives> sections but also between different web.xml / ejb-jar.xml for the <env-entry> settings, right? Or should I use some kind of glassfish.xml to configure the settings inside the application container and then retrieve them all with @Resource(name="java:app/env/foo")?



Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic