23 Jan 2020

feedDZone Java Zone

Modifying Variables Inside Lambdas

Occasionally, we will run into a situation in which we want to modify a variable inside a Lambda expression, but when we try to do so, we get a compile-time error saying:

A variable inside Lambda must be Final or Effective Final.

23 Jan 2020 9:20pm GMT

Spring WebClient and Java Date-Time Fields

What time is it? Java time!

WebClient is the Spring Framework's reactive client for making service-to-service calls. WebClient has become a go-to utility for me; however, I unexpectedly encountered an issue recently in the way it handles Java 8 time fields that tripped me up. This post will go into the details of the date and time fields in Java.

23 Jan 2020 3:06pm GMT

How to Make Your Own Hamcrest Matchers in Kotlin

A Match made in Hamcrest-heaven!

Intro to Hamcrest Matchers

First things first, I should quickly explain what a Hamcrest Matcher is. When conducting unit tests, the built-in assertion types that come with the testing framework are generally pretty limited. They make it very easy for a person to end up with multiple asserts to essentially check one thing. Even if it doesn't contain multiple asserts, those asserts aren't the most fluent to read and don't tell exactly what you're checking.

You may also like: Hamcrest Containing Matchers

That's where Hamcrest Matchers come in (and other assertion libraries, but we're looking at Hamcrest right now). They allow you to define your own more robust and more fluent assertions, essentially. For example, if you were testing whether a method correctly returns an empty String, that test might look something like this:

23 Jan 2020 3:06pm GMT

Introduction to Spring Auto-Wiring [Video]

In the video below, we take a closer look at Spring auto-wiring. Let's get started!

Further Reading

Auto-Wiring in Spring

23 Jan 2020 3:06pm GMT

22 Jan 2020

feedDZone Java Zone

Magic Around Spring Boot Auto-Configuration

Spring, work your magic!

Auto-configuration is probably one of the most important reasons why you would decide to use frameworks like Spring Boot. Thanks to that feature, it is usually enough just to include an additional library and override some configuration properties to successfully use it in your application.

22 Jan 2020 1:30pm GMT

Hero Without a Cape: Stream API

Let's learn more about this Java hero!

In this post, we will be talking about the Stream API added to Java 8 and how it has changed the way we do programs in Java. It added neatness as well as made the code more readable. It helps conduct functional programming in Java. So without any further ado, let's learn more about this Java gem!

22 Jan 2020 1:30pm GMT

Your Guide to Java 8 Optional

One of the most common exceptions Java programmers face is the NullPointerExceptions. This exception is thrown by the JVM at runtime as a runtime exception.

As we all know, a NullPointerException occurs when the application requires an object but it found a null value. Null value cases are one of the most common exceptions overlooked by Java programmers.

22 Jan 2020 1:30pm GMT

21 Jan 2020

feedDZone Java Zone

Rejection in Akka HTTP: Handle Errors Properly

Learn more about rejection in Akka HTTP and how it helps in handling error scenarios in your application.

In this blog, we will demonstrate rejection in the Akka HTTP and how it helps in handling error scenarios in our application. Let's get started.

21 Jan 2020 4:59pm GMT

Spring Dependency Checking With @Required Annotation [Video]

In the video below, we take a closer look at Spring dependency checking with @Required annotation. Let's get started!

Further Reading

A Guide to Spring Framework Annotations

21 Jan 2020 4:59pm GMT

How to Write Thread-Safe-Yet-Scalable Classes

When writing thread-safe classes, the main issue is to separate the data into multiple independent parts - and to choose the right size for those parts. If the part is too small, our class is not thread-safe. If the part is too large, the class is not scalable.

You may also like: 7 Techniques for Thread-Safe Classes

Let us look at an example that further illustrates this scenario:

21 Jan 2020 4:59pm GMT

How Spring Boot Auto-Configuration Works

In my previous post "Why Spring Boot?", we looked at how to create a Spring Boot application, but you may or may not understand what is going on behind the scenes. You may want to understand the magic behind Spring Boot's AutoConfiguration.

Before that, you should know about Spring's @Conditional feature, on which all Spring Boot's AutoConfiguration magic depends.

21 Jan 2020 4:54pm GMT

20 Jan 2020

feedDZone Java Zone

How Do I Compare Strings in Java?

Learn more about comparing Strings in Java using the equals to (=) operator.

In this article, you are going to learn how to compare strings and the problems that occur when you compare string using equals to (=)operator.

You may also like: The Do's and Don'ts of Java Strings

20 Jan 2020 2:04pm GMT

A Bootiful Podcast: Spring Cloud Services' Bella (Yuxin) Bai

Hi, Spring fans! In this week's installment Josh Long (@starbuxman) talks to Spring Cloud Services teammate Bella (Yuxin) Bai.

Further Reading

Microservices Architecture With Spring Boot and Spring Cloud

Microservices Using Spring Boot and Spring Cloud

20 Jan 2020 2:03pm GMT

Easy Mapping JSON to Java Objects Using Jackson

Mapping JSON to Java objects just got a lot easier with Jackson.

Introduction

Jackson is a very popular and efficient Java-based library used to map JSON into Java objects, and vice versa. In this article, I will demonstrate how easy it is to use Jackson for retrieving data in the JSON response received from REST API and save it to a CSV file.

I will be retrieving the financial data from Elektron Data Platform (EDP), which provides access to Refinitiv various sets of data and will be using historical pricing for the sample.

20 Jan 2020 1:57pm GMT

17 Jan 2020

feedDZone Java Zone

Beginners Guide to Mocking in Scala

We all know that unit test cases are one of the most important parts of an application. No? Then, I must tell you that unit testing is one of the earliest tests to be performed on the unit of code, and the earlier the defects are detected, the easier it is to fix. It reduces the difficulties of discovering errors contained in more complex pieces of the application.

So where does mocking come into the picture? Why do we need it? And how do we understand what we should mock while writing unit test cases? Answers to these questions are right below in this blog.

17 Jan 2020 7:24pm GMT

Introducing Picocog: A Lightweight Code Generation Library

Picocog is a lightweight and new open-source Java library created to make programmatic code generation quite easy.

Code generation is the process by which source code can be automatically generated based on inputs.

17 Jan 2020 3:18pm GMT

10 Nov 2011

feedPlanetJava

OSDir.com - Java: Red Hat's top secret Java Killer/Successor: The Ceylon Project

From the Ceylon dept.:

Gavin King of Red Hat/Hibernate/Seam fame recently unveiled the top secret project that he has been working on over the past two years, a new language and SDK designed to replace Java in the enterprise. The project came out of hiding without much fanfare or publicity at QCon Beijing in a keynote titled "The Ceylon Project - the next generation of Java language?".

10 Nov 2011 6:01am GMT

OSDir.com - Java: Oracle Introduces New Java Specification Requests to Evolve Java Community Process

From the Yet Another dept.:

To further its commitment to the Java Community Process (JCP), Oracle has submitted the first of two Java Specification Requests (JSRs) to update and revitalize the JCP.

10 Nov 2011 6:01am GMT

OSDir.com - Java: No copied Java code or weapons of mass destruction found in Android

From the Fact Checking dept.:

ZDNET: Sometimes the sheer wrongness of what is posted on the web leaves us speechless. Especially when it's picked up and repeated as gospel by otherwise reputable sites like Engadget. "Google copied Oracle's Java code, pasted in a new license, and shipped it," they reported this morning.



Sorry, but that just isn't true.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Java SE 7 Released

From the Grande dept.:

Oracle today announced the availability of Java Platform, Standard Edition 7 (Java SE 7), the first release of the Java platform under Oracle stewardship.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Java SE 7 Passes JCP

From the Jitters dept.:

The next edition of Java has been approved by a Java Community Process executive committee, but not without some acrimony.

10 Nov 2011 6:01am GMT

OSDir.com - Java: JDK 7 RC1 Released

From the JDK dept.:

After an initial round of testing we've declared build 147 to be the first Release Candidate of JDK 7.



There are only thirteen changes in this build. Over half of them are administrivial updates that don't affect the actual code; the remainder are true showstoppers, including several hard VM crashes and a JIT correctness bug identified by an Eclipse unit test.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Google Files Sizzling Answer to Oracle's Amended Java Complaint

From the Counter dept.:

Google has filed its answer to Oracle's amended complaint and its memorandum opposing Oracle's Motion to Dismiss. And we find out why Google didn't just roll over and pay Oracle for a license. Oracle asked in its motion to dismiss that the counterclaims alleging that Oracle's patents are invalid be dismissed. So Google explains more thoroughly why it believes they are in fact invalid. First, Google asserts:



Each of the Patents-in-Suit is invalid under 35 U.S.C. ยง 101 because one or more claims are directed to abstract ideas or other non-statutory subject matter.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Apache loses Java showdown vote to Oracle

From the Dis Harmony dept.:

The Apache Software Foundation - one of tech's most influential open-source groups - is closer to quitting Java's governing body after losing a stand-off vote against Oracle on Java.



The Reg has learned that with 75 per cent of qualifying Java Community Process (JCP) members having voted on whether to ratify Oracle's proposed roadmap for Java 7 and 8, Oracle's plan has been accepted.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Apache Software Foundation Resigns from Java Community Process

From the So Long dept.:

The Apache Software Foundation has resigned its seat on the Java SE/EE Executive Committee. Apache has served on the EC for the past 10 years, winning the JCP "Member of the Year" award 4 times, and recently was ratified for another term with support from 95% of the voting community. Further, the project communities of the ASF, home to Apache Tomcat, Ant, Xerces, Geronimo, Velocity and nearly a 100 mainstay java components have implemented countless JSRs and serve on and contribute to many of the JCPs technical expert groups.



We'd like to provide some explanation to the community as to why we're taking this significant step.



The recent Java SE 7 vote was the last chance for the JCP EC to demonstrate that the EC has any intent to defend the JCP as an open specification process, and demonstrate that the letter and spirit of the law matter. To sum up the issues at stake in the vote, we believe that while continuing to fail to uphold their responsibilities under the JSPA, Oracle provided the EC with a Java SE 7 specification request and license that are self-contradictory, severely restrict distribution of independent implementations of the spec, and most importantly, prohibit the distribution of independent open source implementations of the spec. Oracle has refused to answer any reasonable and responsible questions from the EC regarding these problems.

10 Nov 2011 6:01am GMT

OSDir.com - Java: Apache Discontinues Independent Java Implementation 'Harmony'

From the DisHarmony dept.:

After the resignation of Apache from the Java SE/EE Executive Committee, the time has now come for Harmony to be added to the Apache Attic. Harmony was 'the project to produce an open source cleanroom implementation of Java.' An open vote was taken within the Project Management Committee, which resulted in a 20-2 majority to discontinue development.

10 Nov 2011 6:01am GMT

Javable: YourKit Java Profiler 7.0 released

The major update to YourKit Java Profiler has been released. Version 7.0 includes

10 Nov 2011 6:01am GMT

Javable: Sun phases out mobile Java

Sun will gradually phase out mobile Java (Java Micro Edition) and move respective services to Standard Edition. "We're trying to converge

10 Nov 2011 6:01am GMT

Javable: Google Android SDK is available

The development kit and API for Google mobile platform, Android, has been released.

10 Nov 2011 6:01am GMT

Javable: Consumer JRE Early Access

Sun has started an early access program to Java SE 6 Update N (formerly known as the "Consumer

10 Nov 2011 6:01am GMT

Javable: NetBeans 6.0 released

New version of pure Java IDE has been released, with support for many new

10 Nov 2011 6:01am GMT

Javable: Happy New Year!

We wish a Happy New Year to all our readers and contributers. Hope to see you all in 2008.

10 Nov 2011 6:01am GMT