Last active
April 6, 2017 12:10
-
-
Save xandreafonso/7aa0ff916d757bb308acbaeba728ff43 to your computer and use it in GitHub Desktop.
CDI em ambiente desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.jboss.weld.se</groupId> | |
<artifactId>weld-se-core</artifactId> | |
<version>2.4.0.Final</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.enterprise.inject.Instance; | |
import javax.inject.Inject; | |
import org.jboss.weld.environment.se.Weld; | |
import org.jboss.weld.environment.se.WeldContainer; | |
public class WeldSe { | |
public static void main(String[] args) { | |
Weld weld = new Weld(); | |
WeldContainer weldContainer = weld.initialize(); | |
Instance<Object> instance = weldContainer.instance(); | |
WeldSe weldSe = instance.select(WeldSe.class).get(); | |
weldSe.run(); | |
weldContainer.shutdown(); | |
} | |
@Inject @Parameters | |
private List<String> args; | |
@Inject | |
private AnyService anyService; | |
public void run() { | |
anyService.doWork(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment