Skip to content
/ cdi Public

Simple J2EE project to test CDI capabilities on a non JEE environment

Notifications You must be signed in to change notification settings

roqmarcelo/cdi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cdi

Simple J2EE project to test CDI capabilities on a non JEE environment

  1. The following example initializes the Application class in the CDI context.
public static void main(String[] args) {
    CdiContext context = CdiContext.INSTANCE;

    Application application = context.getBean(Application.class);

    application.run();
}
  1. After the initialization, the Application class can use the CDI injectors to create instances of other objects and use other CDI capabilities, like qualification and other stuff
@Singleton
public class Application {

	@Inject @Type(GreetingType.FORMAL)
	Greeting greeting;
	
	public void run() {
		System.out.println(greeting.greet());
	}
}

About

Simple J2EE project to test CDI capabilities on a non JEE environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages