(no commit message)
[utils] / support / cdi / src / test / java / org / wamblee / cdi / BeanManagerSetup.java
1 package org.wamblee.cdi;
2
3 import javax.enterprise.inject.spi.BeanManager;
4
5 import org.jboss.weld.environment.se.Weld;
6 import org.jboss.weld.environment.se.WeldContainer;
7
8 public class BeanManagerSetup {
9
10     private Weld weld;
11     private WeldContainer container;
12     private BeanManager beanManager;
13
14     public BeanManagerSetup() {
15         // Empty
16     }
17
18     public void initialize() {
19         weld = new Weld();
20         container = weld.initialize();
21         beanManager = container.getBeanManager();
22     }
23     
24     public BeanManager getBeanManager() {
25         return beanManager;
26     }
27
28     public void shutdown() {
29         weld.shutdown();
30         weld = null;
31         container = null; 
32         beanManager = null; 
33     }
34 }