Java EE - tarunchhabra/parakalo GitHub Wiki
JakartaEE- vendor neutral
Annotation + Java code = Managed component
JSF- MVC framework - component oriented
-Facelets for templating and composite components
-for developing server side UI in JavaEE
-Data, event binding to CDI visa EL
CDI- context dependency Injection similar to spring core- used for dependency injection
main annotations- @Named,( @Default, @Alternative) , @Inject, @Produces
=> It allows us to manage the lifecycle of stateful components via domain-specific lifecycle contexts and inject components (services) into client objects in a type-safe way.
=> CDI turns DI into a no-brainer process, boiled down to just decorating the service classes with a few simple annotations, and defining the corresponding injection points in the client classes.
- Basic Injection- @Inject, @Qualifier, @Stereotype, @Named, @Produces, @Disposes
=> First, we must place a “beans.xml” file in the “src/main/resources/META-INF/” folder. Even if this file doesn't contain any specific DI directives at all, it's required for getting CDI up and running:
use beans.xml with bean-discovery-mode= "all"
-
managed bean- @Dependent
-
to use these bean @Inject with constructor injection. it's also possible to inject a service by using the @Inject annotation in fields (field injection) and setters (setter injection)
@Inject == @Autowired
@Inject can be used to inject EJB beans or CDI managed beans or produced beans.
-
Context management-@RequestScoped , @SessionScoped, @ApplicationScoped, @ViewScoped, @TransactionScoped , @FlowScoped
-
Lightweight events -Events, @Observes
-
Interceptors/Decorators- @Interceptor , @Decorator
-
Improved testability - Arquillian
=> Weld is the reference implementation of CDI: Contexts and Dependency Injection for the Java EE Platform
web profile- servlet and EJB 3.2
https://www.baeldung.com/java-ee-cdi
we can very easily swap the run-time injection of implementations by simply switching the @Alternative annotations in the service classes.
CDI also allows us to perform service injection with the @Named annotation.
This method provides a more semantic way of injecting services, by binding a meaningful name to an implementation
@Named- provides name to a java component
@Produces - is like @Bean annotation of spring. We don't need to put like @Configuation on factory classes in which these objects are created.
CDI supports the use of custom qualifiers using @Qualifier for qualifying dependencies and solving ambiguous injection points.
cdi-portable-extension
https://www.baeldung.com/cdi-portable-extension
cdi-event-notification
https://www.baeldung.com/cdi-event-notification
=======================================================================================================================
JAXB- for xml to pojo binding
- intelligent defaults and convention-over-configuration
Servlet- to communicate with HTTP
JMS 2 Websocket support JOSN uspport- json-p, json-b
JPA- @Transactional
======================================================================
Resources:
Concepts: https://learning.oreilly.com/videos/modern-java-ee/9781491941621/9781491941621-video234850
detailed: https://learning.oreilly.com/videos/learning-java-ee/9781788831130/9781788831130-video1_2
with baeldung examples: https://learning.oreilly.com/videos/java-ee-8/9781788622189/9781788622189-video1_6