days
0
-35
-6
hours
-1
-6
minutes
-3
-6
seconds
-1
-8
search
The week in Java

Java Weekly 40/15: JMH and CDI, MVC, Microservice truths

Thorben Janssen
News image via Shutterstock

This week’s Java news with Thorben Janssen features some good tips and tricks about microservices, native CDI qualifiers and second early draft release of the MVC specification. Architects also rate a mention along with the week’s hottest Java links.

This post originally appeared on Thorben Janssen’s Java EE blog, where Java news is published weekly: thoughts-on-java.org.

JMH has become the standard for writing microbenchmarks in Java. But it often becomes a little tricky if you want to use it with CDI. OpenEJB provides an easy solution for it as Romain Manni-Bucau points out in his recent blog post: JMH and CDI made easy.

The CDI specification defines the two standard qualifiers @Any and @Default. Abishek Gupta has a look at them in his recent post and gives a few examples on how to use them to inject different versions of an interface: Native CDI Qualifiers: @Any and @Default.

Think of it as an omnipresent qualifier. It’s there even if its not.

Named queries are normally statically defined via @NamedQuery annotations. But what to do with queries that can only be defined at runtime and will not change until the application is shutdown?

You can also use named queries here; you only need to use the Java API to define: How to define named queries at runtime with JPA 2.1.

Java EE 8

The MVC expert group has prepared the second early draft release (EDR2) of the specification. Manfred Riem posted the updated specification and a list changes on the mailing list: MVC EDR2 Ready.

Architecture

When you develop microservices, you quite often run into issues with your local development environment because your microservice interacts with other services. You need to provide these services in some way and the complexity your setup increases with every additional service. Daniel Bryant describes 5 patterns to handle these dependencies in a local environment: Working Locally with Microservices.

In my experience this quickly becomes a nightmare to maintain…

Jinesh Parekh gave an interesting interview about his 4 core truths of microservices, common pitfalls and cases in which you should prefer a monolithic approach: 4 Core Truths About Microservices.

This and that

Jens Schauder wrote an interesting post about two kind of architects that exist in bigger companies. Both kinds have different tasks and view the project from a different angle: ARCHITECT OR ARCHITECT?

How does your company handle the different responsibilities of an architect? Do you have different kinds of architects in your projects?

Author
Thorben Janssen
Thorben is a senior developer and regular Java blogger with more than 10 years of experience in Java EE development and architecture. During these years he has acted as developer, architect, project and technical lead to create high available, clustered mobile billing solutions and laboratory information management systems.

Leave a Reply

avatar
400