• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

General approach migrating from Spring Dependency Injection to CDI?

Posts: 10
Netbeans IDE VI Editor PHP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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")?



With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic