Scoped values is a new API in Java 20 that enables developers to store and share immutable data within and across threads. We look at how to use it and how it works.
Also find me here:
Baeldung Author
Daniel Strmecki
Daniel Strmečki is a Java and AEM Solution Architect with a strong focus on quality, modularity, and reusability. Throughout his career, he gained experience in software development, solution design, project, and people management. Daniel has an open, ambitious, stubborn, and perfectionist personality. He likes sports, modern technology, technical challenges, motivated colleagues, and well-defined processes.
Here's what I've written (so far):
Baeldung on Java
- All
- Java (12)
- Web Services (2)
- NoSQL (2)
- Java Collections (2)
- Testing (1)
- Spring Web (1)
- Spring Persistence (1)
- Spring Data (1)
- Spring Boot (1)
- REST (1)
- Persistence (1)
- Networking (1)
- Maven (1)
- Logging (1)
- Java Streams (1)
- Java Concurrency (1)
- JVM (1)
- HTTP Client-Side (1)
Singleton Design Pattern vs Singleton Beans in Spring Boot
Filed under Spring Boot
Compare singleton beans with objects created using the singleton design pattern.
HTTP Interface in Spring 6
Filed under Spring Web
Spring has a new web client builder that’s similar to OpenFeign, but is native to Spring. We look at how to build API clients with itm .
REST vs. GraphQL vs. gRPC – Which API to Choose?
Filed under REST, Web Services
REST, GraphQL, and gRPC are solutions to different problems when calling webservices. We look at how they differ and can be combined in our architecture.
Guide to MicroStream
Filed under NoSQL, Persistence
MicroStream is an alternative to a database engine. It allows for direct storage of Java objects with queries performed using stream-like APIs. We look at how this new technology can be used.
Use Cases for Static Methods in Java
Filed under Java
Java allows us to declare functions as static. We look at what this means, how static functions differ from others, and some common use cases for preferring static functions.
Posting with Java HttpClient
Filed under Java
From Java 9 onwards, the new HttpClient API provides both a synchronous and asynchronous modern web client. We look at how it can be used to make requests.
Apache HttpClient vs. CloseableHttpClient
Filed under HTTP Client-Side
Look at the difference between Apache HttpClient API’s HttpClient and CloseableHttpClient
Make a Call to a GraphQL Service from a Java Application
Filed under Web Services
GraphQL is a standard for communicating with web services. We look at a few ways to access GraphQL endpoints from a Java application.
Random Number Generators in Java 17
Filed under Java
Java 17 provides a large number of improvements to the generation of random numbers. We explore the new API and compare it with the original random number generators.
Solving the Hide Utility Class Public Constructor Sonar Warning
Filed under Java
We may produce utility classes with static methods in Java and then receive a warning from Sonar about the implicit public constructor. We look at how to handle this error and some alternative implementations for static modules.
Logging Queries with Spring Data Cassandra
Filed under Logging, Spring Data
Explore the logging of queries and statements when using Apache Cassandra with Spring Boot.
Using Test Containers With Spring Data Cassandra
Filed under Spring Persistence, Testing
We can test our Spring Data integration with Cassandra by using Testcontainers. This starts a temporary instance of Cassandra to use during our tests. We investigate how to do this and configure spring during the test.
Saving Date Values in Spring Data Cassandra
Filed under NoSQL
Learn how to use Spring Data Cassandra to save date values and map them to Cassandra data types.
Pattern Matching for Switch
Filed under Java
This article is a deep dive into pattern matching for switch statements, a preview feature in Java 17.
Tiered Compilation in JVM
Filed under JVM
The JVM’s just in time compiler employs multiple techniques to optimize our software as it runs. We explore the various tiers and how they affect startup performance and continued optimization.
The settings.xml File in Maven
Filed under Maven
We can configure maven via the settings.xml file. We look at some common use cases and configuration options.
When to Use a Parallel Stream in Java
Filed under Java Streams
In this tutorial, we’ll explore the differences between sequential and parallel streams using Stream Api.
What Are Compile-Time Constants in Java?
Filed under Java
The Java compiler is able to pre-calculate certain values for us at compile time. This allows us to use some variables with expressions that must be constant, and leads to some runtime efficiencies.
The Java final Keyword – Impact on Performance
Filed under Java
Explore if there are any performance benefits from using the final keyword on a variable, method, and class
Guide to Implementing the compareTo Method
Filed under Java
Learn about how to implement the compareTo method using core Java.
Is Java a Compiled or Interpreted Language?
Filed under Java
Java provides the speed of a compiled language with the portability of an interpreted language. We investigate how the JVM and JIT compiler work, and how to classify Java as a language.
New Features in Java 11
Filed under Java
Java 11 brings new features, including convenience methods in the standard libraries and the integration of the new HTTP Client. We review these and other improvements.
ArrayList vs. LinkedList vs. HashMap in Java
Filed under Java Collections
Learn about the differences between three of the most common Java Collections: ArrayList, LinkedList, and HashMap
Sealed Classes and Interfaces in Java
Filed under Java
Explore sealed classes and interfaces, a preview feature in Java SE 15, delivered in Java 17.
Finding a Free Port in Java
Filed under Java, Networking
Learn about how we can search for free ports for Java servers.
Finding the Differences Between Two Lists in Java
Filed under Java Collections
We investigate how to finding elements present in one list, but not in another, including lists with multiple copies of the same element.