Skip to content

JDD 2016: 6 tips for your JavaEE project be less depressing (Jakub Marchwicki)

Jakub Marchwicki

CommunityPROIDEA Events40 minOpen on YouTube ↗

Engineers explore architecture and security mechanisms for JDD 2016: 6 tips for your JavaEE project be less depressing (Jakub Marchwicki).

Summary

### Overview In this presentation at JDD 2016, Jakub Marchwicki addresses the common frustration and negative perception surrounding enterprise Java EE projects. Often inherited as legacy systems in rigid environments like banking and insurance, Java EE is frequently criticized for being bloated, outdated, or overly restrictive. Marchwicki argues that much of this dissatisfaction stems from corporate cargo-cult practices, poor architectural choices, and developers lacking familiarity with modern platform capabilities. Rather than hastily rewriting working applications in alternative stacks like Spring, Marchwicki outlines five practical technical tips to modernize and streamline Java EE development.

### Key Topics The talk centers on five practical strategies to make Java EE projects cleaner, more productive, and less painful: 1. **Understanding the Modern Stack**: Dispelling misconceptions about Java EE limitations, such as threading restrictions, by highlighting built-in concurrency and asynchronous features. 2. **Treating Standards as Guidance**: Recognizing that perfect vendor portability across application servers is largely a myth in real-world applications, and embracing specific application server features rather than writing awkward workarounds. 3. **Reducing Boilerplate with Extensions**: Utilizing CDI (Contexts and Dependency Injection) extensions, particularly Apache DeltaSpike and DeltaSpike Data, to eliminate repetitive database and repository code. 4. **Going Beyond JPA**: Bypassing heavy ORM frameworks when complex SQL is required by integrating lightweight persistence libraries like JDBI and jOOQ using CDI producer methods. 5. **Decoupling Front-End Development**: Allowing front-end engineers to use modern tooling (Node.js, npm, Bower) while packaging static UI assets into JAR files via Maven and Servlet 3.0 `META-INF/resources`.

### Technical Details - **Concurrency & Events**: While spawning unmanaged threads directly is prohibited because the application server cannot monitor or throttle resources, modern Java EE provides `@Asynchronous` and `ManagedExecutorService` (introduced in Java EE 6/7) to safely manage asynchronous tasks. CDI events also enable reactive, decoupled internal communication. - **Application Server Realities**: Cross-server portability often breaks due to varying interpretations of specifications (e.g., differences in CDI implementations between Weld and OpenWebBeans, or bean resolution between Apache TomEE and WildFly/JBoss). Acknowledging the application server as the concrete framework allows developers to use underlying libraries directly, such as the latest Hibernate or EclipseLink implementations. - **CDI Producers & Apache DeltaSpike**: DeltaSpike Data provides Spring Data–like repository patterns using simple interfaces and query annotations, avoiding repetitive JPA code. Furthermore, CDI `@Produces` methods enable developers to easily inject non-standard objects, custom data mappers, or specialized configurations directly into the dependency injection context. - **Alternative Persistence (JDBI & jOOQ)**: For complex queries involving groupings, concatenations, or vendor-specific SQL, standard JPA native queries add unnecessary overhead. By using CDI producers to expose JDBC connections, teams can cleanly inject JDBI DAOs or jOOQ typed domain-specific languages (DSL) directly into enterprise beans. - **Modern Front-End Integration**: To avoid the rigid styling and steep learning curves associated with JSF (JavaServer Faces), teams can isolate the front end. Using Maven plugins to execute Node/npm builds, front-end assets can be compiled into `target/app` and packaged into a JAR's `META-INF/resources`. Under the Servlet 3.0 specification, any files placed in `META-INF/resources` inside `WEB-INF/lib` JARs (the mechanism behind WebJars) are automatically served as static web assets.

### Takeaways Developers can significantly improve their Java EE development experience without rewriting their systems. By learning recent platform enhancements, embracing their target application server rather than chasing theoretical portability, using CDI producers with modern libraries like jOOQ and DeltaSpike, and packaging separate npm-driven front-ends into Servlet 3.0 resources, teams can build maintainable and productive enterprise applications.

Related talks