2 Replies Latest reply on Dec 27, 2009 3:12 AM by Gavin King

    Simplified "Singleton" pattern in WELD

    Ian R Newbie

      I was just wondering if this was the best way to do a singleton pattern using Weld (I'm not talking about EJBs, I know that's a bit different):

      • Mark a bean as application scoped

      • Use @Inject to inject the class, but don't use @New (to force a new one).

      Would this work in a clustered application, across different servers, or would this be specific to one JVM? Also, is there an easy way to ensure that @New can't be requested?

      Or am I looking for a cheap way around the Singleton pattern and should just stick to the traditional way?