Subscribe: Javalobby - The heart of the Java developer community
Added By: Feedage Forager Feedage Grade A rated
Language: English
annotations  application  automated testing  boot  deployment jar  eclipse  java  jdk  memory  spring boot  spring  start  streams 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Javalobby - The heart of the Java developer community

DZone Java Zone

Recent posts in Java on


A Personal Opinion on the Future of Jakarta EE

Mon, 19 Mar 2018 07:01:01 GMT

The following is just my personal opinion of where Jakarta EE may be going. I am far removed from the decision makers and this opinion is based on what I have read and my experience as a teacher. Feel free to label me a crackpot.

I began to teach J2EE in 2002. It was a mess. Most of my time was spent on explaining the purpose of the numerous XML files and the three strange beans, session, session stateless, and EJB. Of course, this was in the days when it was thought that programs will be frequently reconfigured via their XML files and that pooling the strange beans was the state of the art. When I got a copy of Rod Johnson’s book J2EE Development without EJB, I thought that the concept was intriguing. However, I was required to teach what was most commonly used in industry, and at that time, it was J2EE.

Testing Kotlin With Spock (Part 1): Object

Mon, 19 Mar 2018 04:01:01 GMT

The object keyword in Kotlin creates a singleton in a very convenient way. It can be used, for example, as a state of an operation. Spock is one of the most expressive and readable test frameworks available in the Java ecosystem. Let's see how Kotlin's object can be used in Spock tests.

What Do We Want to Test?

We have a single method, validate, in our Validator interface that returns validation status: Ok or Error.

Doing Stuff With Spring WebFlux

Sun, 18 Mar 2018 05:01:02 GMT

Spring Boot 2.0 went GA recently, so I decided to write my first post about Spring in quite a while. Since the release, I have been seeing more and more mentions of Spring WebFlux along with tutorials on how to use it. But after reading through them and trying to get it working myself, I found it a bit hard to make the jump from the code included in the posts and tutorials I read to writing code that actually does something a tiny bit more interesting than returning a string from the back-end. Now, I’m hoping I’m not shooting myself in the foot by saying that, as you could probably make the same criticism of the code I use in this post, but here is my attempt to give a tutorial of Spring WebFlux that actually resembles something that you might use in the wild.

Before I continue, and after all this mentioning of WebFlux, what actually is it? Spring WebFlux is a fully non-blocking reactive alternative to Spring MVC. It allows better vertical scaling without increasing your hardware resources. Being reactive, it now makes use of Reactive Streams to allow asynchronous processing of data returned from calls to the server. This means we are going to see a lot less Lists, Collections, or even single objects. Instead, we'll see their reactive equivalents such as Flux and Mono (from Reactor). I’m not going to go in depth on what Reactive Streams are, as honestly, I need to look into it even more myself before I try to explain it to anyone. Instead, let's get back to focusing on WebFlux.

Streaming Microservices With Akka Streams and Kafka Streams [Webinar]

Sat, 17 Mar 2018 05:02:15 GMT

One of the most frequent questions that we at Lightbend have been asked is “what’s the difference between Akka Streams and Kafka Streams?” After all, there is only a 1 letter difference between these two technologies, so how different could they be?

Well, as we are about to learn, they are actually quite different. Both tools are part of Lightbend Fast Data Platform, but were created with entirely different technological approaches in mind. For example, Akka Streams emerged as a dataflow-centric abstraction for the Akka Actor model, designed for general-purpose microservices, very low-latency event processing, and supports a wider class of application problems and third-party integrations via Alpakka. Kafka Streams, by comparison, is purpose-built for reading data from Kafka topics, processing it, and writing the results to new topics in a Kafka-centric way.

Building Spring Boot 2.0 Apps: VS Code, Initializr, and Azure Starters

Fri, 16 Mar 2018 16:01:02 GMT

We are excited to announce full support of Spring Boot 2.0 on the Spring Boot Starters for Azure, already available on Spring Initializr. Plus, with new Java and Spring extensions for Visual Studio Code you can build production-ready apps and easily deploy them to the cloud.

Integrate Azure Services With Spring Boot 2.0 Apps

Spring Initializr enables developers to handle the dependency management and makes the bootstrapping process for Spring projects much easier. Today, we’re announcing that the Azure Starters have been updated to support Spring Boot 2.0, so you can easily integrate cloud services with your application.

Using Reactive Streams, Akka Streams, Akka HTTP, and Alpakka For Legacy Integrations

Fri, 16 Mar 2018 10:01:01 GMT

Software is turning more and more into individual services that provide value to individual consumers. It is a part of a greater whole, and in a typical enterprise, we see that multiple generations of technologies must co-exist for systems to function properly as a whole.

In addition to that, the need to integrate with existing systems is increasing. The technologies used can be WebServices, HTTP APIs, databases, or even external devices such as sensors.

Creating an AWS Lambda Deployment JAR Using Maven

Fri, 16 Mar 2018 07:01:02 GMT

One key aspect of AWS Lambda functions (with Java) is creating deployment packages (JAR or ZIP files) for uploading/deploying on the AWS Lambda service. In this post, you will learn different ways in which you can create a deployment JAR file for AWS Lambda projects using Maven. We will look at:

  • Deployment JAR using Maven and Eclipse IDE
  • Deployment JAR using Maven and the command prompt

I recommend using the "Maven and command prompt" technique for creating your deployment JAR package, but we will cover both methods.

Duke Takes His Last Tumble

Fri, 16 Mar 2018 04:01:01 GMT

When Java was first released, the world was a very different place. This was 1995, and the Internet and World Wide Web were still very much in their infancy. When James Gosling and John Gage demonstrated the WebRunner browser (as it was then called) running a Java applet that could rotate a molecule, the world changed. Suddenly, the web went from having only static content with hypertext links to a dynamic, interactive system.

From tiny acorns, mighty oak trees grow (if you’ll excuse the pun) and that’s precisely what we’ve seen with the web. Almost every aspect of our lives, from information access to banking to social interaction, now takes place through the Internet and the web. What we experience through the browser has changed beyond all recognition.

Java Version Upgrades: GC Overview

Thu, 15 Mar 2018 20:01:01 GMT

I'm guessing there are many companies on the verge of upgrading to a newer Java version because developers love to upgrade, but besides this adventurous attitude, there is also fear. The biggest fear of such a change is that applications can produce unexpected behaviors. In my opinion, the root of this fear is the GC system, the fear of the unknown. 

First, we will do a quick walkthrough of how memory management architecture looks, what kind of GC algorithms are available, and what GC types exist. We will then go over how to come up with a plan that is safe and can persuade management that switching to a newer Java version won't be the end of worlds. If you are pretty confident on how the GC works, you can skip to the end of the article where the TODOs are listed. For others, let's start with the architecture for the JVM.

This Week in Spring: Even More Spring Boot 2

Thu, 15 Mar 2018 16:01:01 GMT

Hi, Spring fans! Welcome to another installment of This Week in Spring! This week I’m in blizzard-besieged Boston, Massachusetts, for the epic Spring One Tour Boston event. Unfortunately, due to this crazy snow storm/blizzard, the event’s been postponed one day as we all grapple with the weather. Hope you were able to join the Spring Boot 2.0 launch webinar! If not the replay will be available here and don’t forget to check out the launch blog!

Snow or no snow! The show must go on, at least here on the Spring blog, so without further ado:

Concurrent Java: Scalability, Deadlocks, and Garbage Creation

Thu, 15 Mar 2018 15:54:03 GMT

On the example of three concurrent map implementations, we will see that we have low scalability, the risk of deadlocks, or unnecessary garbage creation. Locks lead to low scalability when we use only one — or risk deadlocks when using multiple locks. Compare and swap operations and immutable data structures, on the other hand, lead to unnecessary object creation, which causes more garbage collection cycles.

So what technique should you choose? If we have a small data structure, we can use an immutable class. And if our data structure is not performance critical, we can use a single lock. In all other cases, I would start with multiple locks, since it is easier to implement than compare and swap operations. But let us first start with the easiest case, a hash map synchronized with a single lock.

Updates on JavaFX, Valhalla, Data Classes, and Java's Floating-Point

Thu, 15 Mar 2018 07:01:00 GMT

There have been some interesting posts this and recent weeks that provide more insight into the future of Java and the JDK.

JavaFX Removed From JDK with JDK 11

In the blog post "The Future of JavaFX and Other Java Client Roadmap Updates," Oracle's Donald Smith announced that "starting with JDK 11, Oracle is making JavaFX easier to adopt by making the technology available as a separate download, decoupled from the JDK." Smith provides a brief history of JavaFX and discusses other motivations for the decision to decouple JavaFX from the JDK.

Build a Microservices Architecture for Microbrews With Spring Boot

Thu, 15 Mar 2018 04:01:01 GMT

Adopting a microservice architecture provides unique opportunities to add failover and resiliency to your systems, so your components can handle load spikes and errors gracefully. Microservices make change less expensive too. It can also be a good idea when you have a large team working on a single product. Your project can likely be broken up into components that can function independently of one another. Once components can function independently, they can be built, tested, and deployed independently. This gives an organization and its teams the agility to develop and deploy very quickly.

In a previous article, I showed you how to build a Spring Boot API with an Angular client. I then showed you how to convert the Angular app into a progressive web application that works offline. The Angular PWA is a good example of a resilient application because it still works when connectivity fails. Did you know you can develop similar resiliency in your API with Spring Boot, Spring Cloud, and a microservices architecture? This article shows you how to convert the previously created Spring Boot application to use microservices. You’ll create a beer catalog service, an edge service (for filter and displaying good beers), and a Eureka service that registers the services and allows them to communicate with one another.

How Synchronization Works in Java (Part 2)

Wed, 14 Mar 2018 20:01:01 GMT

In my previous article, we saw how synchronized blocks execute in Java. We did some debugging in Eclipse IDE as well to understand the flow of execution clearly.

This article focuses more on synchronized methods in Java, so let's begin.

Java Out of Memory Heap Analysis

Wed, 14 Mar 2018 16:01:01 GMT

Any software developer who has worked with Java-based enterprise-class backend applications would have run into this infamous or awkward error from a customer or QA engineer: java.lang.OutOfMemoryError: Java heap space.

To understand this, we have to go back to the computer science fundamentals of the complexity of algorithms, specifically "space" complexity. If we recall, every application has a worst-case performance. Specifically, in the memory dimension, when this is unpredictable or is spiky, more than the recommended memory is being allocated to the application. That leads to an over-usage of the heap memory allocated and hence an "out of memory" condition.

Hello OpenJ9 on Windows, I Didn’t Expect You so Soon!

Wed, 14 Mar 2018 10:01:00 GMT

Faster startup time, lower memory footprint, and higher application throughput only by replacing the Java Virtual Machine? That sounds too good to be true. So far, there has been no real alternative to Oracle’s Java HotSpot VM on Windows. With Eclipse OpenJ9, which emerged from open-sourcing IBM’s J9 VM, there is now the alternative that promises exactly this.

At the end of January, the first OpenJDK 9 with Eclipse OpenJ9 nightly builds for Windows were published, but they were not very stable at that time. This week, I tested the nightly builds again to run the Eclipse IDE and I was pleasantly surprised: OpenJ9 ran without crashing. Here are my results: the start time of the Eclipse Oxygen.2 Java IDE improves with OpenJ9 from 20 to 17 seconds, with some tuning (see below) even to 12 seconds compared to the Java 9 JDK with Oracle’s HotSpot VM on my more than six-year-old laptop. Also, the Windows Task Manager shows less memory used by the Eclipse IDE and tasks like compiling a large project are a bit faster with OpenJ9.

Fluent Assertions With AssertJ

Wed, 14 Mar 2018 07:01:00 GMT

I recently gave a presentation to my Keyhole team members about JUnit 5. I started off the presentation by covering the importance of automated testing, how lack of automated testing affects an organization's ability to deliver code to production, and how without automated testing you are building legacy.

I pointed out two key benefits of automated testing: confidence you are fixing what you set out to fix, and confidence you are not introducing a new bug. A co-worker however pointed out an important third benefit of automated testing: providing living documentation.

Upgrading to Spring Boot 2

Wed, 14 Mar 2018 04:01:01 GMT

Spring Boot 2 was released recently and the production instance of Spring Initializr ( was upgraded to Spring Boot 2 the same day.

In this post, I’d like to walk you through the process of upgrading a Spring Boot 1.x app to Spring Boot 2.

Features in Java 10

Tue, 13 Mar 2018 17:27:47 GMT

Java 9 has changed Java's structure by introducing modular development (Project Jigsaw). Meanwhile, Java 10 will add flavors by introducing new features of its own. A few features are explained below, with snippets.

Local Variable Type Inference

Java 7 introduced the diamond operator:

5 Annotations Every Java Developer Should Know

Tue, 13 Mar 2018 17:02:39 GMT

Since their inception in Java Development Kit (JDK) 5, annotations have become an indispensable part of the Java ecosystem. While there are countless custom annotations developed for use by Java frameworks (such as @Autowired for Spring), there are a few annotations recognized by the compiler that are of supreme importance. In this article, we will take a look at 5 of the annotations supported by all Java compilers and take a look at their intended uses. Along the way, we will explore the rationale behind their inception, some idiosyncrasies that surround their use, and some examples of their proper application. Although some of these annotations are more common than others, each should be internalized by non-beginner Java developers. To start off, we will delve into one of the most commonly used annotations in Java: @Override.


The ability to override the implementation of a method, or provide an implementation for an abstract method, is at the core of any Object-Oriented (OO) language. Being that Java is an OO language and features many of the common OO abstraction mechanisms, a non-final method defined in a non-final superclass or any method in an interface (interface methods cannot be final) can be overridden by a subclass. Although overriding a method appears to be straightforward at first, there are many subtle bugs that can be introduced when overriding is performed incorrectly. For example, it is a common mistake to override the Object#equals method with a single parameter of the type of the overriding class: