package org.wamblee.cdi; import javax.enterprise.inject.spi.BeanManager; import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; public class BeanManagerSetup { private Weld weld; private WeldContainer container; private BeanManager beanManager; public BeanManagerSetup() { // Empty } public void initialize() { weld = new Weld(); container = weld.initialize(); beanManager = container.getBeanManager(); } public BeanManager getBeanManager() { return beanManager; } public void shutdown() { weld.shutdown(); weld = null; container = null; beanManager = null; } }