Skip to content

A small example of how to use dependency injection in Java using the jakarta.inject API and the Weld SE implementation.

Notifications You must be signed in to change notification settings

dafexDev/java-dpi-jsr330

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Dependency Injection JSR-330

Java Maven

A small example of how to use dependency injection in Java using the jakarta.inject API and the Weld SE implementation.

Weld SE is an implementation of CDI (Context and Dependency Injection) in Java SE. The CDI specification is based on JSR-330 for dependency injection, which allows injecting dependencies into objects without the need to explicitly create instances in the code.

Components

  • HelloWorldPrinter: Interface that defines the print method to print a Hello World
  • HelloWorldPrinterCapitalize: Implementation of HelloWorldPrinter that prints Hello World in capitalized format.
  • HelloWorldPrinterUppercase: Implementation of HelloWorldPrinter that prints Hello World in uppercase format.
  • HelloWorldClient: Client that injects all implementations of HelloWorldPrinter and calls the print method of each.

About

A small example of how to use dependency injection in Java using the jakarta.inject API and the Weld SE implementation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages