Complete Java Enterprise Edition 8 specification APIs providing all standardized enterprise application development interfaces
—
CDI and javax.inject APIs for dependency injection, contextual lifecycle management, events, and interceptors.
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Inject;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Named {
String value() default "";
}
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Singleton;@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Scope
public @interface RequestScoped;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Scope
public @interface SessionScoped;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Scope
public @interface ApplicationScoped;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Scope
public @interface ConversationScoped;public interface BeanManager {
Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> ctx);
Object getInjectableReference(InjectionPoint ij, CreationalContext<?> ctx);
<T> CreationalContext<T> createCreationalContext(Contextual<T> contextual);
Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers);
Set<Bean<?>> getBeans(String name);
Bean<?> getPassivationCapableBean(String id);
<X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans);
void validate(InjectionPoint injectionPoint);
void fireEvent(Object event, Annotation... qualifiers);
<T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... qualifiers);
List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... qualifiers);
List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings);
boolean isScope(Class<? extends Annotation> annotationType);
boolean isNormalScope(Class<? extends Annotation> annotationType);
boolean isPassivatingScope(Class<? extends Annotation> annotationType);
boolean isQualifier(Class<? extends Annotation> annotationType);
boolean isInterceptorBinding(Class<? extends Annotation> annotationType);
boolean isStereotype(Class<? extends Annotation> annotationType);
Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType);
Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype);
boolean areQualifiersEquivalent(Annotation qualifier1, Annotation qualifier2);
boolean areInterceptorBindingsEquivalent(Annotation interceptorBinding1, Annotation interceptorBinding2);
int getQualifierHashCode(Annotation qualifier);
int getInterceptorBindingHashCode(Annotation interceptorBinding);
Context getContext(Class<? extends Annotation> scopeType);
ELResolver getELResolver();
ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory);
<T> AnnotatedType<T> createAnnotatedType(Class<T> type);
<T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type);
<T> InjectionTargetFactory<T> getInjectionTargetFactory(AnnotatedType<T> annotatedType);
<X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super X> field, Bean<X> declaringBean);
<X> ProducerFactory<X> getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> declaringBean);
<T> BeanAttributes<T> createBeanAttributes(AnnotatedType<T> type);
BeanAttributes<?> createBeanAttributes(AnnotatedMember<?> type);
<T> Bean<T> createBean(BeanAttributes<T> attributes, Class<T> beanClass, InjectionTargetFactory<T> injectionTargetFactory);
<T, X> Bean<T> createBean(BeanAttributes<T> attributes, Class<X> beanClass, ProducerFactory<X> producerFactory);
InjectionPoint createInjectionPoint(AnnotatedField<?> field);
InjectionPoint createInjectionPoint(AnnotatedParameter<?> parameter);
<T extends Extension> T getExtension(Class<T> extensionClass);
<T> InterceptionFactory<T> createInterceptionFactory(CreationalContext<T> ctx, Class<T> clazz);
}@ApplicationScoped
public class UserService {
@Inject
private EntityManager em;
@Inject
private Logger logger;
public List<User> findAll() {
logger.info("Finding all users");
return em.createQuery("SELECT u FROM User u", User.class)
.getResultList();
}
}
@Named("userBean")
@RequestScoped
public class UserBean {
@Inject
private UserService userService;
private List<User> users;
@PostConstruct
public void init() {
users = userService.findAll();
}
public List<User> getUsers() {
return users;
}
}Install with Tessl CLI
npx tessl i tessl/maven-javax--javaee-api