Showing posts with label Java EE. Show all posts
Showing posts with label Java EE. Show all posts

Saturday, June 6, 2026

Naming Conventions for Java Classes

Naming Conventions for Classes in Spring / Jakarta Applications

For a modern Java application, developers use widely recognized naming conventions that make codebases easier to navigate.

Suppose you want to give a name to objects by what their class is responsible for. The table is organizing so that it show in the first column the purpose of the object and in the other columns convention to follow to give a name to a class.

A small caveat first:

  • @Service, @Repository, and @Controller are Spring stereotypes.
  • Jakarta EE does not provide direct equivalents for all of them.
  • In Jakarta EE, developers often use @ApplicationScoped, @RequestScoped, @Singleton or EJB annotations such as @Stateless.

So the mapping is sometimes exact, sometimes only conceptual.

Tuesday, June 2, 2026

Spring Framework Dependency Injection Complete Example

0. Introduction: Why using interfaces?

A Java interface defines a set of behaviors as abstract methods. A class that implements that interface has to fulfill those behaviors. An interface defines what happens, an object defines how it happens.
Interfaces allow to decouple implementations. This reduces dependencies between implementations and allows to change implementations independently.

Sample Analogy: Booking a Room

Suppose you are designing an application that allows customers to book hotel rooms. When a customer makes a reservation, they are not concerned with the name of the hotel; they are primarily interested in the destination city and the check-in and check-out dates. The room booking application therefore provides an interface in which the customer requests an accommodation, rather than a specific hotel.

Friday, February 23, 2018

Enterprise Beans

Enterprise beans run in the EJB container:

  • the EJB container is a runtime environment within a Java application server
  • the EJB container provides system-level services to enterprise beans such as transactions and security

Content:

  1. What Is an Enterprise Bean?
  2. What Is a Session Bean?
  3. What Is a Message-Driven Bean?

1 What Is an Enterprise Bean?

An enterprise bean is a server-side component that contains the application's business logic

  • for example, in an auction application, the AuctionManager enterprise bean implements the business logic in the methods named createAuction, placeBid, closeAuction.
1.1 Benefits of Enterprise Beans

Enterprise beans simplify the development of large applications:

  • the EJB container, not the developer, is responsible for system level services such as transaction management and security authorization
  • the beans not the clients contain the business logic, the clients only contain the presentation. As a consequence, application clients are thinner
  • enterprise beans are portable, they are portable accross any compliant Java EE server and developers can build new applications from existing beans
1.2 When to Use Enterprise Beans

You should consider using enterprise beans if your application has any of the following requirements:

  • the application must be scalable to support more users and you need to distribute application's components to multiple machines
  • transactions must ensure data consistency
  • application will be accessed by a variety of clients
1.3 Types of Enterprise Beans

There are two types of enterprise beans, which fulfill different purposes:

  • Session: a session bean performs a task for a client
  • Message-driven: a message-driven bean acts as a listener for messages

Tuesday, January 16, 2018

Introduction to Java Platform, Enterprise Edition

Companies need distributed, transactional and portable applications: enterprise java applications fulfill the business logic for the enterprise.

Java platform provides APIs to developers and shortens developement time

The Java Community Process (JCP) writes Java Specification Requests (JSRs) to define the Java EE technologies

The Java EE 7 platform simplifies the programming model:

  • Developers can use annotations in Java source files, instead of optional XML deployment descriptors. The Java EE server reads annotations and configures components at deployment and runtime
  • With dependency Injection, required resources can be injected in component, instead of using JNDI lookup code. Dependency injection can be used in any container type: EJB container, web container and application client container. The container is aware of annotations and inject references to other component/resource

1 Java EE Application Model

Java EE applications implement enterprise services for customers, access data from different sources and distribute applications to a variety of clients

The business functions of Java enterprise applications are in the middle tier: the middle tier is usually on a dedicated server hardware.

The Java application model architecture implements the customer's services as multitier applications

The Java model partitions the work in two parts:

  • business logic and presentation implemented by developers
  • standard services provided by Java EE platform

Friday, September 15, 2017

Requirements of Java EE 7 Enterprise Applications

The Java EE technology elements

Java EE specifications incorporates a group of other technologies and specifications to provide server-side functionalities for enterprise application developers

  • application components: these components allow creation of application business logic and control elements
  • integration: integration elements allow to interact with the functionalities from other applications and systems
  • container management: these elements provide runtime support for Java EE application components