Module io.avaje.inject
Package io.avaje.inject
package io.avaje.inject
Avaje Inject API - see
BeanScope
.
// Annotate classes with @Singleton, @Factory etc
@Singleton
public class CoffeeMaker { ... }
@Singleton
public class Pump { ... }
--------------------------------------------------
// Create BeanScope to wire and access beans
BeanScope scope = BeanScope.builder()
.build();
// use it
CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
coffeeMaker.makeIt();
// close it to fire preDestroy lifecycle methods
scope.close();
-
ClassDescriptionMarks methods on a
@Factory
bean that create dependencies.A bean entry with priority and optional name.Holds beans created by dependency injection.Build a bean scope with options for shutdown hook and supplying external dependencies.Extends the building with testing specific support for mocks and spies.Identify a bean as component with singleton scope that avaje-inject will use.Specify types to generate DI classes for.A singleton bean that has methods marked with the@Bean
annotation.Used to explicitly specify if it depends on externally provided beans or provides.ThePostConstruct
annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization.ThePreDestroy
annotation is used on a method as a callback notification to signal that the instance is in the process of being removed by the container.Identify a bean as being the preferred bean to inject when multiple beans implement the intended interface.ThePriority
annotation can be applied to classes to indicate in what order they should be returned via @BeanScope.listByPriority(Class)
.Expresses a requirement for a bean to be wired/registered into theBeanScope
.Specify a bean that has prototype scope.Marks anMap<String, T>
field/parameter to receive a map of beans keyed by qualifier name.Expresses a requirement for a bean to be wired/registered into theBeanScope
.Expresses a requirement for a bean to be wired/registered into theBeanScope
.Identify a bean as being the least preferred bean to inject when multiple beans implement the intended interface.