Java Reference
In-Depth Information
2
WHAT'S IN THIS CHAPTER?
Introduction to the core concepts of Java EE
➤
Discussion of the multitier structure of an enterprise application
➤
Explanation of Java EE-compliant servers and the web proi le
➤
Convention over coni guration overview
➤
Content Dependency Injection overview
➤
Interceptor overview
➤
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code download for this chapter is found at
www.wrox.com/go/
projavaeedesignpatterns
o
n the Download Code tab. The code is in the Chapter 02
download and individually named according to the names throughout the chapter.
The Java EE programming model has been simplii ed substantially since J2EE. Annotations
have replaced the XML descriptors i les, convention over coni guration have replaced the
tedious manual coni guration, and dependency injection hides the creation and lookup of
resources. Developers need to reconsider their approach to design and coding.
The development of Java EE enterprise applications has gotten easier. All that you need
is a POJO (Plain Old Java Object) annotated with some metadata and, depending on the
annotation used, the POJO becomes an Enterprise JavaBeans (EJB, stateful or stateless), a
servlet, a JSF backing bean, a persistence entity, a singleton, or a REST web service. You can
optionally declare many of these services using XML in a deployment descriptor.
Listing 2‐1 shows how to make a POJO into a singleton bean that is instantiated
and initialized at start‐up and then managed by the container simply by adding the