Kayıtlar

Mayıs, 2019 tarihine ait yayınlar gösteriliyor

Java EE Annotations

JSR 250 ( Common Annotations ) Since Java EE 5 (May 11, 2006) & Java SE 6 All non-Java EE JSR 250 annotations were added to the Java SE with version 6 (Generated, PostConstruct, PreDestroy, Resource, Resources). Yellow ones are security-related annotations. javax.annotation package Annotation Description @ Generated Marks sources that have been generated @ Resource Declares a reference to a resource, e.g. a database @ Resources Container for multiple Resource annotations @ PostConstruct Is used on methods that need to get executed after dependency injection is done to perform any initialization. @ PreDestroy Is used on methods that are called before the instance is removed from the container @ Priority Is used to indicate in what order the classes should be used. For, e.g., the Interceptors specification defines the use of priorities on inte

Dependency Injection In Java and CDI

Dependency injection(DI) is one of the key techniques that enables a class or module to be injected into another, which also enables us to apply the principal of seperation of concerns via enabling a way of entity association and making wiring easy. Along with Java EE 5, dependency injection was made of a part of the specification with JSR 250 (Common Annotations). For basic usages of injection, it has been a good start for Java platform especially with the annotations; @ManagedBean and @Resource. Since Java EE 6, JSR 330 (Dependency Injection for Java) was introduced and the frequently used annotations like @Inject and @Named were made available. And ultimately, Contexts and Dependency Injection was also introduced with Java EE 6 which is built on top of JSR 330. Comparing to DI, CDI additionally provides an easy to use event mechanism, decorators and interceptors to add functionality to beans. Since Java EE 5 with the EJB 3.0 specification, Java EE also provides injection for E