Learn how to return a value from a thread that has its job terminated
Also find me here:
Baeldung Author
baeldung
This is the standard author on the site. Most articles are published by individual authors, with their own profiles, but when multiple people have a strong contribution, we publish collectively here.
Here's what I've written (so far):
Baeldung on Java
- All
- Java (953)
- Weekly Review (340)
- Spring (234)
- Testing (172)
- Persistence (171)
- Spring Boot (148)
- Java Collections (144)
- DevOps (134)
- REST (115)
- Spring MVC (97)
- Data (96)
- Programming (90)
- Spring Security (88)
- Spring Data (86)
- Jakarta EE (77)
- NoSQL (76)
- Algorithms (74)
- Java Concurrency (67)
- Security (62)
- Reactive (58)
- Docker (58)
- JSON (54)
- Maven (52)
- HTTP Client-Side (51)
- Spring Web (42)
- Spring Cloud (41)
- Spring Persistence (40)
- Series (40)
- Guava (34)
- Cloud (28)
- Jackson (26)
- Logging (24)
- Gradle (24)
- Architecture (24)
- XML (19)
- IDE (16)
- Networking (10)
- Web Services (8)
- News (1)
How to Display a Full HTTP Response Body With Gatling
Filed under Testing
Learn how to display on the console the full HTTP response body with Gatling.
Java Weekly, Issue 492
Filed under Weekly Review
Exhaustiveness in Pattern Matching, dynamic threads for JVM compilers, JFR events in shell, association attributes in JPA, and zero downtime migrations at scale!
Replacing Variables in a Document Template with Java
Filed under Programming
Learn how to replace a pattern in various locations of a Word document.
Understanding JPA/Hibernate Associations
Filed under Persistence
Learn about the differences between unidirectional and bidirectional associations in JPA/Hibernate.
Spring Boot Properties Prefix Must Be in Canonical Form
Filed under Spring Boot
Learn how to avoid Spring Boot configuration properties errors by using canonical kebab-casing formats.
Java Serialization: readObject() vs. readResolve()
Filed under Java
Learn the differences between the readObject() and readResolve() methods of the Java Serialization API.
Fix Command Line is Too Long in IntelliJ
Filed under Programming
A quick and practical guide to solving the “Command Line is Too Long” issue in IntelliJ IDEA.
Configuring Gradle Tasks in Spring Boot 3
Filed under Gradle, Spring Boot
A quick and practical guide to configuring Gradle tasks in Spring Boot 3.
Convert Hashmap to JSON Object in Java
Filed under Java Collections, JSON
Learn how to convert a Map to JSON in Java.
Array vs. List Performance in Java
Filed under Java Collections
Explore the performance of arrays and lists in Java.
Java Weekly, Issue 491
Filed under Weekly Review
Simplified main entries, CDC for cache, cloud-native Graal, key encapsulation, and event sourcing and audit logs!
Generating Javadoc With Gradle
Filed under Gradle
Learn how to generate Javadoc using the Gradle build system.
Object.toString() vs String.valueOf()
Filed under Programming
Discover the differences between the String.valueOf() and Object.toString() methods.
Classpath vs. Modulepath in Java
Filed under Java
Explore the distinction between the modulepath and classpath in Java.
Custom WebFlux Exceptions in Spring Boot 3
Filed under REST, Spring Boot
Learn about the ProblemDetail RFC7807 exception format provided by the Spring Framework and how to create and handle custom exceptions in Spring WebFlux.
Working With Empty Stream in Java
Filed under Java
Understand intermediate and terminal operations in Java Streams and learn how to create and check for an empty Stream.
Creating Custom Iterator in Java
Filed under Java Collections
Learn how to create a custom iterator in Java and apply it to our collections.
Java Weekly, Issue 490
Filed under Weekly Review
Java performance is the theme this week, with a lot of interesting pieces.
How to List All Pods and Its Nodes in Kubernetes
Filed under DevOps
Explore commands to retrieve information about all pods and their assigned nodes.
Shared Secret Authentication in Spring Boot Application
Filed under Spring Boot, Spring Security
Private microservices may use a shared secret to protect their APIs from illegal access. We look at how to implement a simple token based security pattern based on a shared secret using Spring Security.
Hashing With Argon2 in Java
Filed under Security
Learn about hashing and salting techniques and understand how to hash with Argon2 in Java.
Opening a New Tab Using Selenium WebDriver in Java
Filed under Testing
Explore two approaches to opening a new tab with Selenium.
Should We Create an Interface for Only One Implementation?
Filed under Programming
Explore the practical implications of creating an interface for a single implementation in Java and understand the pros and cons of this approach.
Regular Expression: \z vs \Z Anchors in Java
Filed under Java
Explore the differences between \z and \Z anchors, how they work, and when to use them.
Difference Between implementation and compile in Gradle
Filed under Gradle
Learn the difference between “implementation” and “compile” in Gradle and provide best practices for effective dependency management
ArrayBlockingQueue vs. LinkedBlockingQueue
Filed under Java Collections, Java Concurrency
Learn about the implementation differences between ArrayBlockingQueue and LinkedBlockingQueue.
Difference Between null and Empty String in Java
Filed under Java
Learn how “null” and empty strings behave in different scenarios.
Java Weekly, Issue 489
Filed under Weekly Review
Unnamed methods in Java, Hibernate 6 migration, async-profiler, generative AI and jobs, and monoliths are not dinosaurs!
Java: Read Multiple Inputs on Same Line
Filed under Java
Learn how to read multiple inputs on the same line using the Scanner class.
Converting an AAR File to a JAR File
Filed under Java
Learn the steps to convert an AAR file to a JAR file.
Overriding hashCode() And equals() For Records
Filed under Java
Learn how records provide us with a default implementation of equals() and hashCode() methods.
Difference Between FileReader and BufferedReader in Java
Filed under Java
Learn how to use FileReader and BufferedReader and the differences between them.
Lombok EqualsAndHashCode Annotation
Filed under Programming
Learn about Lombok’s @EqualsAndHashCode annotation, which generates the equals() and hashCode() methods for a class based on its fields.
Uploading File Using Selenium Webdriver in Java
Filed under Testing
Learn how to upload files using Selenium WebDriver.
Why an HTTP GET Request Shouldn’t have a Body
Filed under REST
Learn why we shouldn’t send HTTP GET requests with a body and understand the consequences of doing it.
Encode Passwords With Spring Boot CLI
Filed under Spring Boot, Spring Security
Learn how to avoid exposing passwords by encoding them with the help of Spring Boot CLI.
Java Weekly, Issue 488
Filed under Weekly Review
Pattern matching and records patterns for Java 21, generational ZGC, Spring transactions, JSON views, low latency queues, and naming!
Find the Index of an Element in a Java Array
Filed under Java Collections
Learn various methods for finding the index of an array element using both Java’s built-in APIs and a third-party library.
How to Persist a List of String in JPA?
Filed under Spring Data
Explore what kind of possibilities there are in JPA to store a list of strings of an entity.
Getting Pixel Array From Image in Java
Filed under Algorithms
Learn how to get a two-dimensional array that contains the combined RGB values for every pixel in an image in Java.
Retrieve the Value of an HTML Input in Selenium WebDriver
Filed under Testing
Learn how to set up a Selenium project and retrieve the value of an HTML input field from a web page.
Boolean Converters in Hibernate 6
Filed under Persistence
Learn how to map boolean properties in the domain model using boolean converters added in Hibernate 6.
Java Weekly, Issue 487
Filed under Weekly Review
Java 20, adaptive GC for Quarkus, JFR event streaming, Java threading primitives, maintainable software, and HTTP stats codes!
JAVA_HOME vs PATH Environment Variables
Filed under Java
Explore the differences between using the JAVA_HOME and PATH environment variables.
A Guide to FlexyPool
Filed under Spring Boot, Spring Persistence
Learn learn how to use FlexyPool with Spring Boot and H2 using the HikariCP connection pool.
Overview of NLP Libraries in Java
Filed under Java
Explore different NLP libraries in Java and see how to implement some NLP tasks using Apache OpenNLP and Stanford CoreNLP.
Functional vs. Non-Functional Testing
Filed under Testing
Learn the differences between functional and non-functional testing, and explore several types of testing for each.
Execute Tests Based on Active Profile With JUnit 5
Filed under Spring Boot, Testing
Learn how to execute tests based on the active Spring profile using JUnit 5.
Java Weekly, Issue 486
Filed under Weekly Review
Another preview of Foreign Functions, Jakarta REST, Scala 3 annotations, Postgres power features, and Scalable Slack!
Configuring Protobuf Compilation with Custom Source Directories
Filed under Java, Programming
Learn how to configure a custom source directory for protobuf files.
Buffer Overflows in Java
Filed under Programming
Discover what Buffer Overflow is and the threats it poses to our system.
Check if a Specified Key Exists in a Given S3 Bucket Using Java
Filed under Cloud
Learn how to check if a specified key exists in an Amazon S3 bucket using Java.
Get All Cached Keys with Caffeine Cache in Spring Boot
Filed under Spring Boot
A quick and practical guide to getting all cached keys in the Caffeine Cache when used with Spring’s Cache.
Parsing Date Strings with Varying Formats
Filed under Java
Explore strategies for parsing multiple date formats at once.
Convert Integer to Hexadecimal in Java
Filed under Java
Learn how to convert an integer value to hexadecimal in Java.
Reuse StringBuilder for Efficiency
Filed under Java
Explore the advantages of reusing a StringBuilder and explore a concrete example of how to do it.
Understanding Java’s Classpath vs. Build Path
Filed under Java
Learn the difference between the classpath and the build path in Java.
Java Weekly, Issue 485
Filed under Weekly Review
Virtual threads in Java 21, Java profilers, a new build system for Java, auto-explain for Postgres, and Generative AI!
Integrate AWS Secrets Manager in Spring Boot
Filed under Spring Boot
AWS Secrets Manager is a good place to store credentials for databases or other services. We look at how to provide our Spring Boot application with secrets from Secrets Manager at runtime.
Deserialize Generic Type with Jackson
Filed under Jackson
Explore two simple ways to deserialize a JSON string into an object with a generic type.
Java Helper vs. Utility Classes
Filed under Architecture, Java
Explore the difference between Java helper and utility classes
Hibernate @CreationTimestamp and @UpdateTimestamp
Filed under Persistence
This article explains how to use Hibernate annotations @CreationTimestamp and @UpdateTimestamp to track the creation and update timestamps of an entity in a Java application using the Hibernate framework.
Java Program to Estimate Pi
Filed under Algorithms
Learn how to estimate the value of pi using the Monte Carlo algorithm in Java.
A Guide to Spring Cloud Azure Key Vault
Filed under Security, Spring Cloud
Explore the fundamental principles of cloud-native development and the benefits of using Spring Cloud Azure Key Vault.
Java Weekly, Issue 484
Filed under Weekly Review
Increased GC throughput, writing a profiler from scratch, faster JVM startup, Java 20, and large language models!
Java Weekly, Issue 483
Filed under Weekly Review
Migrating to Hibernate 6, lots of new releases and sending billions of messages per minute, over TCP/IP. A good week 🙂
Databases: Simple vs. Complex vs. Materialized Views
Filed under Persistence
Learn how simple and complex SQL views differ from materialized views.
Difference Between Openjdk Docker Images: Slim vs Slim-Stretch vs Stretch vs Alpine
Filed under Docker
Learn about the differences between various Docker images of OpenJDK.
Difference Between parallelStream() and stream().parallel() in Java
Filed under Java Collections, Java Concurrency
Explore the ways we can create parallel Streams from a Collection data source.
Skip a Stage in a Jenkins Pipeline
Filed under DevOps
Explore different solutions for skipping stages in a Jenkins-scripted pipeline.
Difference Between asText() and toString() in JsonNode
Filed under Jackson
Learn about asText() and toString() methods for working with JSON data in Java.
Lightweight Kubernetes Distributions
Filed under DevOps
Learn about different lightweight distributions of Kubernetes and when to use them.
SAML with Spring Boot and Spring Security
Filed under Spring Boot, Spring Security
Learn how to sett up SAML2 with Spring Boot.
Java Weekly, Issue 482
Filed under Weekly Review
Java 20 is out! Nuff said 🙂
Run a Spring Boot Application in AWS Lambda
Filed under Cloud, Spring Boot
AWS has released a library to help convert a Spring Boot application into an AWS Lambda. We look at how to use this library and how to deal with long cold start times.
Spring R2DBC Migrations Using Flyway
Filed under Spring Data
Learn how to use Flyway migrations for a Spring Data R2DBC application.
Difference Between Pod and Container in Kubernetes
Filed under DevOps
A quick and practical comparison between pods and containers in Kubernetes.
Difference Between Deployment and ReplicaSet in Kubernetes
Filed under DevOps
Learn about Kubernetes Deployment and ReplicaSet features, advantages, use cases, and their key differences.
Change Swagger-UI URL prefix
Filed under Spring Boot
Learn how to change the Swagger-UI URL prefix when using Springfox and how to set up the REST API documentation using OpenAPI 3.0 with redirections.
Java Weekly, Issue 481
Filed under Weekly Review
Java is evolving and growing up. We’re getting close to Java 20 🙂
Configuring Spring Cloud FeignClient URL
Filed under Spring Cloud
Learn different ways of setting up a URL using Spring Cloud FeignClient.
How to configure Redis TTL with Spring Data Redis?
Filed under Spring Boot, Spring Data
Explore various approaches to setting Redis TTL via Spring Data Redis.
Difference Between Javac and the Eclipse Compiler
Filed under Java
A comparison between the Java compiler and the Eclipse compiler.
Get the Desktop Path in Java
Filed under Java
A quick and practical guide to getting desktop path in Java.
Java Weekly, Issue 480
Filed under Weekly Review
String Interpolation in Java. Finally. And some profiler limitations.
Running Stages in Parallel With Jenkins Workflow / Pipeline
Filed under DevOps
Learn how to run multiple stages in parallel with a Jenkins workflow or pipeline job.
How to Use –init Parameter in Docker Run Command
Learn how to use the –init parameter in the Docker run command.
Service Profiles in Docker
Learn how to use service profiles in Docker.
Introduction to Interface Driven Development (IDD)
Filed under Architecture, Java
Explore the advantages of IDD and an example of how to use it.
Getting Started With K3s
Filed under DevOps
Learn the main features of K3s and create a simple cluster as an example.
Change Date Inside a Docker Container
Explore various ways to change the date and time of a Docker container.
Get the Output of a Shell Command Executed Using Into a Variable in Jenkins Pipeline
Filed under DevOps
Explore two different methods for capturing the output of a shell command executed in the Jenkins pipeline into a variable.
Post form-url-encoded Data with Spring Cloud Feign
Filed under Spring Cloud
Learn how to use Feign to make POST API requests with form-url-encoded data in the request body.
Migrate Application From Spring Boot 2 to Spring Boot 3
Filed under Spring Boot
Learn how to migrate a Spring Boot application to Spring Boot 3.
Java Weekly, Issue 479
Filed under Weekly Review
Java security API, Kotlin 2.0 compiler, testcontainers, web apps with Loom, safer refactorings, and write stuff down!
Guide to Java Project Panama
Filed under Java
Project Panama aims to ease the interaction between Java and foreign (non-Java) APIs, i.e., native code written in C, C++, etc.
Exclude a Dependency in a Maven Plugin
Filed under Maven
A quick and practical guide to excluding a transitive dependency from a Maven plugin.
Download a Webpage in Java
Filed under HTTP Client-Side, Java, Networking
Learn how to download a webpage in Java using Jsoup and HttpURLConnection.
Copying All Keys and Values From One Hashmap Onto Another Without Replacing Existing Keys and Values
Filed under Java Collections
Explore ways to copy the entries from one HashMap to another while preserving the existing entries of the target HashMap.
Java Weekly, Issue 478
Filed under Weekly Review
Spring 3 Native support, TSID with Hibernate, window functions in Hibernate, placing features in systems, and Human OS!
Finding All Duplicates in a List in Java
Filed under Java Collections
Learn different ways of extracting duplicate elements from a List in Java.
Introduction to Roaring Bitmap
Filed under Java
Learn about the roaring bitmap data structure, understand some of its operations, and see how it performs compared to BitSet.
Database Keywords as Columns in Hibernate Entities
Filed under Persistence
Learn how to avoid cryptic Hibernate exceptions by properly escaping database keywords in column names.
VarArgs vs Array Input Parameters in Java
Filed under Java
A quick and practical comparison between varargs and arrays as input parameters.
Migrate From Java 8 to Java 17
Filed under Java
Explore some extremely useful features available in the newer versions of Java. These features aren’t only easy to learn but can also be implemented quickly without much effort when planning to migrate from Java 8 to Java 17.
Looking for a Backend Java/Spring Team Lead with Integration Experience (Remote) (Part Time)(not open)
Filed under Spring
Looking for a Java Team Lead with integration experience to join the Baeldung team.
javax vs. java Package
Filed under Java
Explore examples of both java and javax packages and understand the key differences between them.
Difference Between Class.forName() and Class.forName().newInstance()
Filed under Java
A quick and practical comparison between Class.forName() and Class.forName().newInstance()
Guide to Quarkus Funqy
Filed under DevOps
Learn about Quarkus Funqy as a great addition that helps to run Java functions on the Serverless infrastructure.
Java Weekly, Issue 477
Filed under Weekly Review
Faster Image IO in Java 21, enhanced escape analysis, type-safe stream API queries, scalable media ML, and efficient one-on-ones!
Record vs. Final Class in Java
Filed under Java
Explore the differences between records and final classes in Java.
Convert Hex to RGB Using Java
Filed under Java, Programming
Learn how to convert a hex color code to an equivalent RGB value in Java.
Java Weekly, Issue 476
Filed under Weekly Review
Records in Hibernate, pattern matching, flexible Gradle, Java GC, and Stream Processing with Hazelcas.
Callback Functions in Java
Filed under Java
A quick and practical guide to callback functions in Java.
OpenTelemetry Setup in Spring Boot Application
Filed under Spring Boot, Spring Cloud
Deploying microservices can lead to challenges in tracing requests across those services. With OpenTelemetry we’re able to capture logs from independent services and use them to observe traces of entire requests. We look at how to achieve this in Spring.
Java Team Lead with Spring Experience (Remote) (Part Time)
Filed under Java
Looking for a Java Lead with Spring experience to join the Baeldung team.
Securing Passwords in Docker
Explore several methods to secure passwords in Docker, including using environment variables, a secret management system, and a key management system.
Guide to HTTPie for Terminal
Filed under HTTP Client-Side
Learn how to install and use the HTTPie CLI tool.
How Do I Generate a Dashboard Report in JMeter?
Filed under Testing
Learn about generating JMeter dashboard reports which are a more useful, efficient, and easy way to analyze data than mere text
Reading PDF File Using Java
Filed under Java
Learn two different ways of reading PDF files in Java using the popular Apache PDFBox and iText libraries.
Java Weekly, Issue 475
Filed under Weekly Review
Fast Java 21, compact strings, static mocks, native GC for Quarkus, async stack trace, and non-vulnerable microservices!
Determine if a Class Implements an Interface in Java
Filed under Java, Programming
Learn several ways to determine if an object or a class implements a specific interface.
Stream to Iterable in Java
Filed under Java Collections
Learn different ways for using a Stream as an Iterable.
Generate Unit Test Data in Java Using Instancio
Learn how to eliminate manual data setup in tests by auto-generating the data using Instancio.
Enable BuildKit with Docker Compose
Filed under Docker
Learn how to enable BuildKit with Docker Compose.
Java HttpClient – Map JSON Response to Java Class
Learn four ways to map JSON responses to a POJO class when using Java HttpClient.
Communicating With Docker Containers on the Same Machine
Filed under Docker
Explore how two containers can connect on the same machine using Docker Compose
Structured Concurrency in Java 19
Filed under Java, Java Concurrency
Learn about structured concurrency capabilities in Java 19.
Java Weekly, Issue 474
Filed under Weekly Review
Safe native memory management with Java, scaling DAO layer in Spring apps, releasing to maven central, REST glory, and window functions in MySQL!
Ahead of Time Optimizations in Spring 6
Filed under Spring Boot
What’s the concept of AOT and how is applied in Spring 6 looking at pros and cons.
Introduction to ScyllaDB with Java
Filed under NoSQL
Explore ScyllaDB.
Convert byte[] to MultipartFile in Java
How to convert a byte array into a class which implements the Spring MultiPartFile interface.
Converting a Number from One Base to Another in Java
Filed under Java
Learn how to convert numbers from one base to another in Java.
Differences Between Spring Data JPA findFirst() and findTop()
Filed under Spring Data
Learn about the findFirst() and findTop() methods from Spring Data JPA.
Convert an ArrayList of Object to an ArrayList of String Elements
Filed under Java Collections
Discover strategies to normalize lists of objects to strings in Java.
Batch Processing of Stream Data in Java
Filed under Guava, Java Collections
Explore how to accomplish batch processing of Stream data in Java using both native features and some third-party libraries.
Lambda Expression vs. Anonymous Inner Class
Filed under Java
A quick and practical comparison between lambda expressions and anonymous inner classes.
Java Weekly, Issue 473
Filed under Weekly Review
Kotlin 1.8, infinite memory with Java 20, DTO projections with Blaze persistence, API design patterns, and functional classes.
How to Stop a Zombie Job on Jenkins Without Restarting the Server?
Filed under DevOps
Learn how to stop a zombie job on Jenkins.
Java Weekly, Issue 472
Filed under Weekly Review
Project Panama update, Spring Boot CLI, GraalVM, Jakarta MVC, YugabyteDB pooling, and software maintenance!
Implementing Retry in Kafka Consumer
Filed under Spring
Learn how to implement retry logic on a Kafka topic, including blocking and non-blocking approaches.
Class Methods vs Instance Methods in Java
Filed under Java
A brief comparison between class and instance methods in Java.
Lightweight Logging With tinylog 2
Learn the fundamental logging methods and configuration parameters of the tinylog 2 logging framework and understand how to issue log entries.
Jenkins Pipeline – Change to Another Folder
Filed under DevOps
Learn how to change the working directory in a Jenkins pipeline.
Record Patterns in Java 19
Filed under Java
Learn how record patterns allow us to extract the values of a record into variables using pattern matching.
Difference Between JPA and Spring Data JPA
Filed under Spring Data
Learn how Spring Data JPA and JPA both work with some high-level overviews and code snippets.
Java Weekly, Issue 471
Filed under Weekly Review
MongoDB, Spring Modulith, liveness and startup probes for Spring Boot, Kafka on K8S, JVM debugging internals, and BigTable pagination in Java. Happy New Year 🙂
Working With Multiple Repositories in Gradle
Filed under Gradle
Learn how to use libraries from multiple repositories when working on a Gradle project and how to use GitHub Package Registry for authenticated repositories.
Fixing the “No Such DSL method” Error in Jenkins Pipeline
Filed under DevOps
Learn how to fix the “No such DSL method” error in Jenkins Pipeline.
Comparing Two JAR Files in Java
Filed under Java
A quick and practical guide to comparing JAR files.
NonUniqueResultException in Spring Data JPA
Filed under Spring Data
Learn about the NonUniqueResultException in Spring Data JPA and discover strategies to avoid it.
Using Watermarks with iText in Java
Filed under Java
Learn how to add watermarks to generated PDF and to an existing PDF using iText.
How to Get the API Token for Jenkins
Filed under DevOps
Learn how to generate and use an API token in Jenkins.
What Is the Default WORKDIR in a Dockerfile?
Filed under DevOps
Learn about the default value of the WORKDIR instruction in Docker.
Java Weekly, Issue 470
Filed under Weekly Review
Pattern matching, GraalVM into OpenJDK, transactional MDC, event sourcing, and Postgres as a Message Queue!
Trigger Another Job from a Jenkins Pipeline
Filed under DevOps
Learn how to create a job that internally triggers another job in Jenkins.
Java Weekly, Issue 469
Filed under Weekly Review
GraalVM in OpenJDK, entity listeners, MicroProfile 6.0, RabbitMQ vs Kafka, and data pipelines at scale!
Run Multiple Commands in Docker Run
Learn how to run multiple commands on the startup of a Docker container.
Getting a Value in JSONObject
Filed under JSON
A quick and practical guide to getting a value from JSONObject.
Reading and Writing With a ConcurrentHashMap
Filed under Java Collections, Java Concurrency
A quick and practical guide to reading and writing from a hash table data structure in a thread-safe way using the ConcurrentHashMap class.
When to Use Callable and Supplier in Java
Filed under Java
Learn the differences between Callable and Supplier interfaces and understand when to use them.
Sorting a HashSet in Java
Filed under Java Collections
Learn multiple techniques to sort the elements of a HashSet.
Fixing Git ‘remote: Repository not found’ Error
Filed under DevOps
A quick and practical guide to fixing “Repository not found.” git errors.
Extract Values using AssertJ in Java
Learn two ways to extract an object’s value to be asserted on.
Java Weekly, Issue 468
Filed under Weekly Review
JMS enhancements, JakartaEE Serverless, revisiting DTO, Golang impressions, and new a K8S release!
Update Jenkins from WAR
Filed under DevOps
Learn how to update Jenkins with the Jenkins WAR file.
Convert Between int and char in Java
Filed under Java
Learn how characters are internally represented in Java and how we can convert an int to a char and back.
Alternatives for instanceof Operator in Java
Filed under Java
Learn alternatives to the traditional instanceof approach to improve code design and readability.
Running Multiple Thread Groups in JMeter
Filed under Java Concurrency, Testing
A Thread Group allows us to simulate a specific type of workflow. We can run Thread Groups in parallel, or sequentially. We look at how to achieve this in JMeter.
Reversing a Stack in Java
Filed under Java
A quick and practical guide to reversing a Stack in Java.
Set the Date Format Using Apache POI
Filed under Data
A quick and practical guide to configuring date format with Apache Poi.
Functors in Java
Filed under Java
Learn what is a Java Functor.
Handle Browser Tabs With Selenium
Filed under Testing
Learn how we handle browser tabs with Selenium.
Java Weekly, Issue 467
Filed under Weekly Review
Panama improvements, fast Java startup in AWS lambda, Spring Boot error handling, TSID vs UUID, and dependency inversion!
A Guide to Spring CredHub
Filed under Spring
Learn how to integrate CredHub with Spring Boot using the Spring CredHub library.
How to Sync a Forked Repository on GitHub
Filed under Programming
Learn how to sync a fork with its original repository using both GitHub’s web UI and the command line.
Errors and Exceptions in Java
Filed under Java
Explore the differences between errors and exceptions in the Java ecosystem.
Java Weekly, Issue 466
Filed under Weekly Review
Spring Boot 3, from 1RPS to 26RPS, caching effect, K8S secrets, and unusual stack traces!
String Interpolation in Java
Filed under Java
Explore the topic of String interpolation in Java.
Difference Between Map.ofEntries() and Map.of()
Filed under Java Collections
Take a closer look at these two static factory methods for immutable maps and explain which one is suitable for which purpose.
Choosing the Right Java Collection
Filed under Java Collections
Explore all collection interfaces and collection classes in the Java library.
How to Serialize a Singleton in Java
Filed under Java, Persistence
Learn how to create a serializable singleton class in Java.
Convert Between LocalDateTime and ZonedDateTime
Filed under Java
Learn how to convert an instance of LocalDateTime to ZonedDateTime and vice versa.
Uses for Optional in Java
Filed under Java
Understand the purpose of the Optional class and learn how to use it efficiently to design clear and robust APIs.
Find the First Non Repeating Character in a String in Java
Filed under Algorithms, Java
Explore different approaches to finding the first non-repeating character in a string.
Java Weekly, Issue 465
Filed under Weekly Review
Spring 6, Quarkus Jakarta EE migration, Kotlin on RaspberryPi, REST API over database schema, and logical replication.
BuildScripts Blocks in Gradle
A quick and practical guide to BuildScripts Blocks in Gradle.
Java Course Team Lead with Spring Experience (Remote) (Part Time) (not open)
Filed under Java
Looking for a Java Lead with Spring experience to join the Baeldung team.
Expression Types in Thymeleaf
Filed under Java
Learn the different expression types available in Thymeleaf with examples.
Access HTTPS REST Service Using Spring RestTemplate
Filed under REST, Security, Spring Security
Learn how to consume a REST service secured with HTTPS using Spring’s RestTemplate.
How to Run TestNG Tests on Jenkins
Learn the steps needed to run TestNG tests on Jenkins.
Sort Collection of Objects by Multiple Fields in Java
Filed under Java Collections
Learn different approaches for sorting collections by comparing multiple fields.
Java Weekly, Issue 464
Filed under Weekly Review
Spring 6 is finally out. Boot 3 is coming as well. Definitely a good week 🙂
Retry with Delay in RxJava
Filed under Reactive
A quick and practical guide to retrying with delay in RxJava.
Iterate Through Two ArrayLists Simultaneously
Filed under Java Collections
Java does not provide an explicit way to iterate over two lists at the same time. We look at some techniques and libraries that can help us correlate data between two collections according to index.
Inserting an Object in an ArrayList at a Specific Position
Filed under Java Collections
Learn how to add a new element at a specific position to an ArrayList.
The Factory Design Pattern in Java
Filed under Architecture, Java
Explore the factory design pattern.
Thread vs. Single Thread Executor Service
Filed under Java Concurrency
Learn the difference between a thread and an executor service having a single worker thread.
Spring @EnableMethodSecurity Annotation
Filed under Spring Security
Learn the main features of @EnableMethodSecurity and how it replaces @EnableGlobalMethodSecurity.
Retain Only Digits and Decimal Separator in String
Filed under Java
Explore four approaches for removing all non-numeric characters from a Java String while keeping the decimal separator.
Kong Ingress Controller with Spring Boot
Filed under DevOps, Docker, Spring Boot
Explore the use of the Kong Ingress Controller to manage access to a Spring Boot application deployed on a K8s cluster.
Java Weekly, Issue 463
Filed under Weekly Review
Java thread deprecations, JPA locking, JVM logging, pattern matching, consistent caching at scale, and event sourcing!
Fixing Selenium WebDriver Executable Path Error
Filed under Testing
Understand what causes the Selenium error “The path to the driver executable must be set by the webdriver.chrome.driver system property” and learn how to fix it.
Generate Unique ObjectId in MongoDB
Filed under NoSQL
A quick and practical guide to generating unique ObjectId in MongoDB.
How to Check if All Runnables Are Done
Filed under Java Concurrency
Learn how to check if runnable objects are done.
Convert String to Instant
Filed under Java
Learn how to convert String to Instant with Java.
Difference Between Map and MultivaluedMap in Java
Filed under Java Collections
Explore the differences between Map and MultivaluedMap.
Java Weekly, Issue 462
Filed under Weekly Review
Java serialization, better VSCode for Java, JFR event streaming, functional programming issues, and standard errors for HTTP APIs.
A Guide to LinkedHashSet in Java
Filed under Java Collections
Explore the LinkedHashSet data structure from the Java Collections library.
Using Groovy in Spring
Filed under Spring
Explore the Spring framework’s extensive support for Groovy and learn how to create bean definitions using different approaches.
assertAll() vs Multiple Assertions in JUnit5
Filed under Testing
Normally a single assertion failure will stop a unit test. However, we can group assertions together, and report on their combined success or failure, using assertAll() within JUnit 5.
Java Weekly, Issue 461
Filed under Weekly Review
Java 19 improvements for collections and a new incarnation of switch in Java. Also, Spring Boot 3 and Spring 6 are even closer.
TLS Setup in MySQL and Spring Boot Application
Filed under Spring Security
Learn how to enable a secure connection on a MySQL server.
Implementing Factory Pattern With Generics in Java
Filed under Java
Learn how to implement and use the factory pattern in Java.
Java Weekly, Issue 460
Filed under Weekly Review
Less footprint with Project Leyden, observability in Spring Boot 3, Hibernate 6 migration, high-performance java serialization, and logical replication!
Coupling in Java
Filed under Java
Explore coupling in Java.
Kotlin/Spring Developer to help with brainstorming topics for a site (Remote) (Part Time)
Filed under Programming
Kotlin Topic Developer
How to Resolve Spring Webflux DataBufferLimitException
Explore what DataBufferLimitException is and how to fix it on both the server and client sides.
Uploading a File and JSON Data in Postman
Filed under JSON, Spring Web
Learn how to upload files and JSON data when using Postman.
Java Weekly, Issue 459
Filed under Weekly Review
Sequenced collections, loom and spring, better Criteria API, Apache InLong, Zally, and API standardization.
Editing Existing PDF Files in Java
Filed under Programming
Learn how to edit the content of an existing PDF file in Java.
Setting Time-To-Live Value for Caching
Filed under Spring
Learn how to set TTL caching for Spring-based caching.
Port Scanning With Java
Filed under Java, Networking
A quick and practical guide to port scanning in Java.
Exclude a Sub-Folder When Adding a Volume to Docker
Filed under Docker
Learn how to exclude folders when mounting volumes with some Docker Compose examples
Enable HTTPS in Jenkins
Filed under DevOps
Learn how to secure Jenkins with HTTPS, SSL, and a proxy.
Java Weekly, Issue 458
Filed under Weekly Review
On using Spring MVC well, an interesting tool to migrate a Spring project to Boot and some testing goodness. A busy week, overall.
Difference Between Flux and Mono
Learn the difference between Flux and Mono of the Reactor Core library.
Using HAProxy as an API Gateway for Routing and Rate Limiting
Filed under DevOps, Networking
Learn how to use HAProxy as an API Gateway for routing and rate limiting.
Writing a List of Strings Into a Text File
Filed under Java, Java Collections
A quick and practical guide to writing a List of Strings into a text file.
A Guide to Variables in Postman
Filed under REST
Learn about variables in Postman.
Set vs List in Java
Filed under Java Collections
Explore the difference between a List and a Set in Java.
Getting a URL Attribute Value in Thymeleaf
Filed under Spring
A quick and practical guide to getting a URL attribute value in Thymeleaf.
How to Clone a Jenkins Job
Filed under DevOps
Learn how to clone a Jenkins job.
Java Weekly, Issue 457
Filed under Weekly Review
Paving the on-ramp – definitely going to help people get started with Java
Validate UUID String in Java
Filed under Java
Learn how to validate a UUID string by using regular expressions or the static method of the UUID class.
Differences Between Paths.get and Path.of
Filed under Java
Learn about the similarities and differences between the methods Paths.get() and Path.of().
Java Scanner Taking a Character Input
Filed under Java
Learn how to take char input using the Java Scanner.
Keep Subdirectory Structure in Dockerfile Copy
Filed under Docker
Learn to copy a directory into a Docker image preserving the subdirectory structure.
Updating PATH Environment Variable in Dockerfile
Filed under Docker
Learn how to update the PATH variable in Docker.
Java Weekly, Issue 456
Filed under Weekly Review
Java 19 is here. Nuff said.
Create a BMI Calculator in Java
Filed under Java
Learn how create your own BMI Calculator in Java.
String Concatenation in Java
Filed under Java
Learn how to concatenate strings in Java.
TriFunction Interface in Java
Filed under Java
Find out how TriFunction interface works for functional programming in Java.
Assign Static IP to Docker Container and Docker-Compose
Filed under Docker
Learn how Docker manages IP allocation and how to add a static address to a container.
Fixed Size Queue Implementations in Java
Filed under Java Collections
Learn what fixed-size queues Java has to offer and how to create a new implementation.
Java Weekly, Issue 455
Filed under Weekly Review
Loomified Helidon, no object allocations, extent-local vars, Java 19/20, Postgres-compatible distributed database, and request waiting list.
Adding a Comment in a Dockerfile
Filed under Docker
Learn how to add comments in a Dockerfile.
Convert between JSON and Protobuf
Filed under JSON
Learn how to convert JSON to protobuf and vice versa.
Java Weekly, Issue 454
Filed under Weekly Review
JIT internals, project Loom, DTO/entity mapping, micro-batching, monolith to microservices, and object storage in K8S!
Guide to Find the Java .class Version
Filed under Java
Learn how to find the Java release version for .class and jar files.
Java Program to Find the Roots of a Quadratic Equation
Filed under Java
Learn how to find the solutions of a quadratic equation in Java.
Connect to Multiple Databases Using Spring Data MongoDB
Filed under NoSQL, Spring Data
Learn how to create multiple connections with Spring Data MongoDB.
Java Weekly, Issue 453
Filed under Weekly Review
Collections performance, null key/values, CORS, state of JVM languages, tornadoVM, and key-range partitioning!
Rebuild Docker Container in Docker Compose
Filed under Docker
Learn how to rebuild a container independently from the others with docker-compose.
Feign Client Exception Handling
Filed under Spring Cloud
We’ll demonstrate how to handle exceptions in Feign in a Spring Boot project.
Java Weekly, Issue 452
Filed under Weekly Review
All about the G1 collector this week. Oh, and Java 19 is close – less than a month away. Good summer 🙂
Swagger: Specify Two Responses with the Same Response Code
Filed under Spring Web
Learn how to write an API specification that returns two different objects for the same response code using Java and Swagger.
Difference Between Arrays.asList() and List.of()
Filed under Java Collections
Java provides some helper functions for us to build List objects from arrays. We look at how they work and the capabilities and limitations of the resulting List objects.
Spring JDBC Batch Inserts
Filed under Spring Persistence
How batch operation can increased insert performance.
Debugging an Application Running in Docker With IntelliJ IDEA
Filed under Docker
Learn different configuration options we can use to debug a dockerized application in IntelliJ
Export/Import Jobs in Jenkins
Filed under DevOps
Learn how to export and import Jenkins jobs.
Java Weekly, Issue 451
Filed under Weekly Review
Java bytecode, extent-local variables, CDC and transactional outbox pattern, test containers, and clock-bound wait in distributed systems!
Integer.toString() vs String.valueOf() in Java
Filed under Java
Learn about the Integer.toString() and String.valueOf() methods.
Propagating Exceptions With OpenFeign and Spring
Filed under Spring Boot
Let’s look at a few strategies for handling errors received during OpenFeign requests.
Sending SOAP Request via Postman
Filed under Web Services
Discover how to set up and call SOAP services through Postman.
Mounting Multiple Volumes on a Docker Container
Filed under Docker
Learn how to mount multiple volumes on a Docker container with the command line and with Docker Compose
Executing Multiple Commands in Docker Compose
Filed under Docker
Learn about ways to execute multiple commands with Docker Compose.
Java Weekly, Issue 450
Filed under Weekly Review
Serial GC, MySQL batching, GraalVM update, sequenced collections, services in K8S, open APIs, and K8S 1.25!
How to Configure Conditional Dependencies in Gradle
Filed under Gradle
Learn how to configure conditional dependencies in a Gradle project.
Get the Number of Messages in an Apache Kafka Topic
Filed under Data
Learn a few techniques for getting the number of messages in a Kafka topic.
Interactive Shell Using Docker Compose
Filed under Docker
Learn how to get an interactive shell and interface Docker containers with it.
Replace Element at a Specific Index in a Java ArrayList
Filed under Java Collections
A quick and practical guide to replacing elements at a specific index in a Java ArrayList.
Dockerizing a Java Application
Filed under Docker
A quick and practical guide to dockerizing a Java application.
Java Weekly, Issue 449
Filed under Weekly Review
Parallel GC, DB sequences for Spring Data JDBC, multitenancy with Hibernate, feature flags, and durability in message queues!
Upload Image With Spring Boot and Thymeleaf
Filed under Spring Web
A quick and practical guide to uploading images with Spring and Thymeleaf.
Get the Current Stack Trace in Java
Filed under Java
Learn how to get a stack trace using the Thread and Throwable classes
Spring Boot 3 and Spring Framework 6.0 – What’s New
Filed under Spring Boot
Learn about new features that come with Spring Boot 3 and Spring 6.
Import Swagger APIs into Postman
Filed under Spring
A quick and practical guide how to import Swagger APIs to Postman.
Using Environment Variables in Spring Boot’s Properties Files
Filed under Spring Boot
Learn how to use environment variables in Spring Boot’s application.properties.
Scanning Java Annotations at Runtime
Filed under Java
Learn about scanning Java annotations at runtime.
Spring Security: Upgrading the Deprecated WebSecurityConfigurerAdapter
Filed under Spring Security
Learn how to create a Spring Security configuration without using WebSecurityConfigureAdapter
Static vs. Instance Initializer Block in Java
Filed under Java
A short article explaining the differences between static and instance instantiation.
Filter Java Stream to 1 and Only 1 Element
Filed under Java
Learn two methods from Collectors to retrieve the unique element which matches a certain predicate in a given stream of elements.
Java Weekly, Issue 448
Filed under Weekly Review
Storing monetary values, GraalVM enhancements, project Amber, backend for frontends, and predicting OOMs!
Find the Differences Between Two Git Branches
Filed under Programming
Learn methods of finding the differences between Git branches on Linux.
Apply Default Global SecurityScheme in springdoc-openapi
Filed under Spring
Learn how to use springdoc-openapi to define a default global security scheme and apply it as the default security requirement of the API.
Why Maven Doesn’t Find JUnit Tests to Run
Filed under Maven
A practical guide to solving Maven test running issues.
Java Weekly, Issue 447
Filed under Weekly Review
Hibernate UUIDs, Kotlin coroutines, max database connections, K8S native Java, and advocate vs educator!
A Guide to Java Source and Target Options
Filed under Java
Learn how the -source and -target options work in Java 8 and how they’ve evolved from Java 9 onwards
Communication Between Multiple Docker Compose Projects
Filed under Docker
Learn how to use a network to connect multiple Docker Compose projects with some docker-compose.yml examples
Modify a Specified Commit in Git
Filed under Programming
A quick and practical guide to modifying a git commit.
Difference Between links and depends_on in Docker Compose
Filed under Docker
Learn the difference between Docker links and depends_on with some practical examples using Docker Compose
Validate an XML File Against an XSD File
Filed under XML
Learn how to validate an XML file against an XSD file.
Spring Boot – Keycloak Integration Testing with Testcontainers
Filed under Spring Security
A step by step guide to test the authentication of a Spring Boot app using Keycloak
Java Weekly, Issue 446
Filed under Weekly Review
Type inference in Java, JShell, GraalVM on build pipelines, tracing Spring apps, secure API gateway, and cloud-native GitOps!
Advantages and Disadvantages of Using Java Wildcard Imports
Filed under Java
Learn the advantages and disadvantages of using wildcard import statements in Java.
Clearing a StringBuilder or StringBuffer
Filed under Java
Learn how to clear a StringBuilder or StringBuffer in Java.
Guide to Creating Jar Executables and Windows Executables from Java
Filed under Java
Learn how to package a Java program into a Jar and make them executable in Windows.
Instantiating Multiple Beans of the Same Class with Spring Annotations
Filed under Spring
Learn three different approaches for instantiating multiple beans of the same class using Spring annotations.
Java Weekly, Issue 445
Filed under Weekly Review
The cost of logging, becoming an open-source committer, and a quick piece about why HTTP3 is fast. A quick and to-the-point week 🙂
UUID as Entity ID in MongoDB
Filed under Spring Data
Learn to use a UUID as an entity ID in MongoDB.
Difference Between form-data, x-www-form-urlencoded and raw in Postman
Filed under Web Services
Learn the difference between form-data, raw and x-www-form-urlencoded request body types in Postman.
How to Convert InputStream to Base64 String
Filed under Java
Learn how to use Java Streaming IO functions and the built-in Base64 class to load binary data as an InputStream and then convert it to a String.
Java Weekly, Issue 444
Filed under Weekly Review
Stateless sessions in Hibernate, calling native variadic functions, fetching collections in JPA, project Leyden, and hard stuff in computer science!
Root User and Password Inside a Docker Container
Filed under Docker
Learn how to run commands inside a Docker container with different users.
JavaScript Function Call with Thymeleaf
Filed under Spring MVC
Learn how to call JavaScript functions in a Thymeleaf template.
Java Weekly, Issue 443
Filed under Weekly Review
G1GC, data-oriented programming with project amber, Spring transactions, automated testing, and diversity of browser engines!
Creating JAR Files Programmatically
Filed under Java
Learn how to create and add files to a JAR programatically.
How to Modify Git Commit Messages
Filed under Programming
Learn how to modify Git commit messages.
Share Volume Between Multiple Containers in Docker Compose
Filed under Docker
Learn how to share Docker containers’ data using volumes
Difference Between Flux.create and Flux.generate
Filed under Reactive
Understand the generate() and create() methods of the Flux API.
Handle Spring Security Exceptions With @ExceptionHandler
Filed under Spring Security
Learn to handle Spring Security Exceptions with @ExceptionHandler.
What Are the Spring Boot Default Memory Settings?
Filed under Spring Boot
Learn about the default values of various heap and stack memory configuration options available for Java applications.
A Guide to Docker Private Registry
Filed under Docker
Learn how to set up a private Docker registry, and push/pull images.
Java Weekly, Issue 442
Filed under Weekly Review
JFR improvements, less footprint for Java, hibernate additions to Criteria API, the Flexcoin race condition, and product backlog.
Is There a Destructor in Java?
Filed under Java
Learn about the possibility of object destruction in Java.
Difference Between parseInt() and valueOf() in Java
Filed under Java
Learn the differences between the parseInt() and valueOf() methods of the java.lang.Integer class in Java.
Unit Test Private Methods in Java
Filed under Testing
Why it’s not a good idea to test a private method and how to do it if it’s extremely necessary.
Java Weekly, Issue 441
Filed under Weekly Review
Java GCs, Project Panama, Spring Data JDBC, multiset vs joins, structured concurrency, and HTTP/3.
Disabling Keycloak Security in Spring Boot
Filed under Spring Security
Learn how to disable the configuration put in place by the Spring Keycloak starter.
How to Mock HttpServletRequest
Learn multiple ways to mock a HttpServletRequest object when unit testing Servlet code in Java.
Java “int/char Cannot Be Dereferenced” Error
Filed under Java
Take a closer look at the Java error “int cannot be dereferenced”, learn the leading cause of the exception, and see how to fix it.
Expose GraphQL Field with Different Name
Filed under Web Services
Learn how a GraphQL field can be exposed with a different name.
Java Weekly, Issue 440
Filed under Weekly Review
Java 9 cleaners, structured concurrency in Java 19, definitely non-nullable types in Kotlin, native Java, and maxUnavailable for StatefulSets.
Sorting Objects in a List by Date
Filed under Java Collections
Learn how to sort a Java Collection by Date object in both ascending and descending modes.
Difference Between docker stop and docker kill Commands
Filed under Docker
Explore the difference between the execution of the docker stop and the docker kill command.
Difference Between Thread’s Context Class Loader and Normal Class Loader
Filed under Java
Explore the difference in the behavior of current and thread class loaders in Java.
How to Play Sound With Java
Filed under Java
Learn how to play sound two ways using the Java Sound API
Setting Request Headers Using Feign
Filed under REST
OpenFeign is a library that helps us build clients to web services by expressing the contract in a Java interface. We look at how to include header values in our requests through the interface, with fixed and dynamic values, and how to handle cross-cutting concerns like authorization by using interceptors.
Java Weekly, Issue 439
Filed under Weekly Review
Static images for Java, C2 visualization, gazillion threads, Spring Boot 3.0, Java 9 cleaners, and oversized data in Postgres.
A Guide to Docker Logs
Filed under Docker
Learn different ways to monitor the logs of a container.
Java HttpClient Timeout
Filed under HTTP Client-Side
Learn how to configure a timeout using the new Java HTTP Client to handle requests when timeouts overflow.
Difference Between Docker-Compose and Kubernetes
Filed under Docker
Learn some of the differences between Docker Compose and Kubernetes using a simple example
Difference Between git merge and rebase
Filed under Programming
Explore the basic difference between git merge and git rebase which every developer should know while working with git VCS.
RequestLine with Feign Client
Filed under REST
Learn how to use @RequestLine annotation in Feign client.
Get Domain Name From Given URL in Java
Filed under Networking
Learn different ways to get a domain name from a given URL in Java.
Java Weekly, Issue 438
Filed under Weekly Review
Structured Concurrency, destructing patterns for Records, a JVM crash story, gRPC probes, and index scans in Postgres!
Find Files That Match Wildcard Strings in Java
Filed under Java
Learn how to search for files using wildcard patterns in Java
Apache ActiveMQ vs. Kafka
Filed under Architecture
A comparison between Apache ActiveMQ and Kafka.
Java Scanner useDelimiter with Examples
Filed under Java
Learn how to use the useDelimiter method of the Scanner class.
Converting a JDBC ResultSet to JSON in Java
Filed under Persistence
Learn three different ways to convert a JDBC ResultSet to a JSON object.
A Guide to Tag in Docker
Filed under Docker
Learn how to create and manage tags in Docker.
Reverse a Number in Java
Filed under Java
Learn how to reverse a number using a mathematical approach in Java.
Java Weekly, Issue 437
Filed under Weekly Review
Hunting down a JVM crash, loom first-take, reactive architectures, more of Hibernate 6, new Transaction API in Quarkus and public-key cryptography.
Differences Between Iterator and Iterable and How to Use Them?
Filed under Java Collections
Explore the usage of Iterable and Iterator interfaces in Java and understand the differences between them.
Java HttpClient With SSL
Filed under Networking
Learn how to use the Java HttpClient to connect to HTTPS URLs and also find out how to bypass certificate verification in non-production environments.
Configuring a Proxy in Docker
Filed under Docker
Learn how to set up a proxy in Docker.
JPA and Hibernate – Criteria vs. JPQL vs. HQL Query
Filed under Persistence
A comparison between Criteria Query, JPQL, and HQL Query.
Differences Between set() and lazySet() in Java Atomic Variables
Filed under Java Concurrency
Learn the differences between set() and lazySet() methods of atomic classes in Java and understand when to use which method.
Java Weekly, Issue 436
Filed under Weekly Review
Project loom in Java 19, ZGC in Java 18, empty finalize, cloud-native Micronaut, symmetric cryptography, and K8S 1.24.
Swap Two Variables in Java
Filed under Java
Learn how to swap two variables in Java, depending on the type of the variables.
PostgreSQL with Docker Setup
Filed under Docker
Learn how to install the PostgreSQL database using the Docker container.
Compile Multiple Java Source Files Using the Command Line
Filed under Java
We can use the javac tool to compile source files in Java. We look at how to use it for multiple source files and how to control which libraries are included and where the compiled code will be written.
Finding All Beans with a Custom Annotation
Filed under Spring
A quick and practical guide to finding all custom-annotated beans in Spring.
Error Handling in GraphQL With Spring Boot
Filed under Spring
A practical guide to GraphQL error handling with Spring Boot.
Java Scanner.skip method with examples
Filed under Java
A quick and practical guide to Java Scanner’s skip() method.
Java Weekly, Issue 435
Filed under Weekly Review
Pattern matching 3rd preview, list in Hibernate 6, custom JFR events, splitting tests in Gradle, and chopping the monolith!
Gradle Build Cache Basics
Local and remote Gradle build cache and how to clear them.
Illegal Character Compilation Error
Filed under Java
Learn about the Illegal Character Compilation Error and how to avoid it.
Looking for a Backend Java/Spring Developer with Integration Experience (Remote) (Part Time)
Filed under Spring
Looking for a Java Dev with integration experience to join the Baeldung team.
Spring Tutorial
A collection of tutorials on Spring
Get the IP Address of the Current Machine Using Java
Filed under Networking
Learn various methods to retrieve the local and public IP addresses of the current machine using Java.
Reduce Build Context for Docker Build Command
Filed under Docker
Learn about the concept of the build context in Docker.
Docker – Removing Dangling and Unused Images
Filed under Docker
Learn why dangling and unused images are common in Docker.
Return Map from GraphQL
Filed under Web Services
Learn three different techniques to return a Map object from a GraphQL query.
Java Weekly, Issue 434
Filed under Weekly Review
Native Java on K8S, switch expressions, cloud-native with Quarkus, Hibernate SQM, and ML pipelines at scale!
How to Store HashMap<String, ArrayList> Inside a List
Filed under Java Collections
Learn about storing HashMaps inside a List in Java.
Running Docker Containers Indefinitely
Filed under Docker
A brief explanation about entrypoint and cmd to understand when a container terminates and how we can prevent it.
Creating a Java Array from Regular Expression Matches
Filed under Java
Learn to look for patterns in a string of text in Java.
Difference Between Running and Starting a Docker Container
Filed under Docker
Learn how the Docker run and start commands are different while going through some practical examples
Checking Connection to MongoDB
Filed under NoSQL
Learn how to check the connection of the MongoDB server with different real-time cases.
Java HttpClient Basic Authentication
Filed under HTTP Client-Side
Learn how to configure the Java HttpClient for basic authentication and how it works.
Spring Boot Configuration Properties Migrator
Filed under Spring Boot
Explore a support system provided by Spring to facilitate Spring Boot upgrades
List vs. ArrayList in Java
Filed under Java Collections
When using collections in Java it’s conventional to use the interface types for our variables and fields, rather than the concrete types. We look at the difference between these two approaches.
Implements vs. Extends in Java
Filed under Java
A quick and practical comparison between the implements and extends keywords in Java.
Spring Cloud – Disable Discovery Clients with Profiles
Filed under Spring Cloud
While Spring’s service discovery mechanisms can be very helpful we may wish to turn them off in certain environments. We look at how to achieve this with both properties files and Spring profiles.
Java Weekly, Issue 433
Filed under Weekly Review
Testcontainers, Project Panama, zoned date-times in Hibernate 6, Spring RCE, CRDTs, and changes in K8S 1.24!
Liquibase vs Flyway
Filed under Persistence
Comparison between Liquibase and Flyway.
Return Only Specific Fields for a Query in Spring Data MongoDB
Filed under NoSQL, Spring Data
Learn how to use projections in Spring Data MongoDB to restrict the fields that are returned from a query
Hide a Request Field in Swagger API
Filed under REST
A quick and practical guide to hiding a request field in Swagger UI.
BootstrapMode for JPA Repositories
Filed under Persistence
Learn the different types of BootstrapMode for JPA repositories.
A Guide to JPA Buddy
Filed under Persistence
Explore JPA Buddy and its main features and see how we can use them during the application development cycle.
Get Environment Variable from Docker Container
Filed under Docker
Learn how to retrieve all the environment variables from a Docker container.
Common Command-Line Compile Errors in Java
Filed under Java
Learn about some common command-line compile errors in Java.
Java Weekly, Issue 432
Filed under Weekly Review
Spring RCE, JavaDoc Snippets, native Java, update on Project Loom, value classes, and automated tests!
Basic Authentication in JMeter
Filed under Testing
We can use JMeter to load test endpoints with Basic Authentication in a few different ways. We look at the simplest method of adding credentials directly to a header, along with how to provide a set of credentials from a data source.
Java Error “variable might not have been initialized”
Filed under Java
How to solve “variable might not have been initialized” in Java.
Retrieve a Value from MongoDB by Its Key Name
Filed under NoSQL
Learn how to retrieve the value by key name in MongoDB.
Docker: “build” Requires 1 Argument Error
Filed under Docker
Learn about the issues related to the Docker build command.
Java Weekly, Issue 431
Filed under Weekly Review
Spring with Java 17 baseline, simple web server, test containers, AOT in Spring 6, ZGC, and the age of APIs!
Bulk Update of Documents in MongoDB
Filed under NoSQL
Learn how to perform bulk operations in MongoDB using different kinds of write operations.
Guide to Upsert in MongoDB
Filed under NoSQL
Learn how to perform upsert operations with various update methods of MongoDB.
Logging MongoDB Queries with Spring Boot
Filed under NoSQL, Spring Boot
Learn how to enable a debug logging level for Spring Data MongoDB
The for-each Loop in Java
Filed under Java
Learn all about the the for-each loop in Java – its syntax, benefits and drawbacks, and examples.
Java Weekly, Issue 430
Filed under Weekly Review
Java 18 is here, composite ids in JPA, Java language evolution, security features in Java 18, error handling, and a better hiring process!
Import Data to MongoDB From JSON File Using Java
Filed under NoSQL
Learn how to import data to MongoDB from JSON files
Get the Number of Rows in a ResultSet
Filed under Persistence
Learn the different ways of counting the number of rows of a JDBC ResultSet.
SSO with Apache Tomcat
Learn how to configure SSO with Apache Tomcat.
A Guide to @DBRef in MongoDB
Filed under Spring Data
Learn how to use Spring Data MongoDB’s @DBRef annotation to connect related documents.
Java Weekly, Issue 429
Filed under Weekly Review
Java 18 GC improvements, cooperative thread interruptions, best practices for Java projects, feature flags, and scaling bottleneck.
Push Operations in MongoDB
Filed under NoSQL
Learn how to insert documents into an array in MongoDB.
Difference Between POJO, JavaBeans, DTO and VO
Filed under Java
Learn what Data Transfer Object (DTO), Value Object (VO), Plain Old Java Object (POJO), and JavaBeans are. Understand the differences between them and when to use each type.
Automorphic Numbers in Java
Filed under Java, Programming
Understand what an automorphic number is and learn a couple of approaches in Java to determine if a number is automorphic.
Convert long to int Type in Java
Filed under Java
A quick and practical guide to long to int conversion in Java.
Using Nginx as a Forward Proxy
Filed under DevOps, Networking
Learn how to use Nginx as a forward proxy for any requested location.
Push and Set Operations in Same MongoDB Update
Filed under NoSQL
Learn how to apply multiple operations together in a single MongoDB query.
Set List of Objects in Swagger API Response
Filed under REST
Learn how to modify the Swagger API response to deliver a list of objects.
Acquire a Lock by a Key in Java
Filed under Java Concurrency
Learn how we can get a lock on a specific key to prevent concurrent actions on that key without impeding actions on other keys
Authentication With Spring Security and MongoDB
Filed under NoSQL, Spring Security
Learn how to authenticate a user using Spring Security and MongoDB
Java Weekly, Issue 428
Filed under Weekly Review
Reconsidering DTOs, Spring Shell, Cloud CVEs, technical debts, and how we found dirty pipe vulnerability!
Check Collection Existence in MongoDB
Filed under NoSQL
Explore various ways to check the existence of a collection using the MongoDatabase and DB class methods.
Retrieve Original Message From Feign ErrorDecoder
Filed under REST
Learn to retrieve the original message from Feign ErrorDecoder.
Update Documents in MongoDB
Filed under NoSQL
Explore various ways to update the documents in MongoDB.
Does GC Release Back Memory to OS?
Filed under Java
Learn how Java Garbage Collection works.
Java Weekly, Issue 427
Filed under Weekly Review
It’s all about the future: Java 18 & 19, Hibernate 6 features, Groovy 4, Kotlin 1.6.2, permitted sealed classes, and API evolution.
Update Multiple Fields in a MongoDB Document
Filed under NoSQL
Explore various ways to update multiple fields of a document in MongoDB.
Caching Maven Dependencies with Docker
Learn how to build Maven projects in Docker
What Is an Apache Maven Artifact?
Filed under Maven
Learn what a Maven artifact is and get an understanding of coordinates, dependency management, and repositories.
Difference Between assume-unchanged and skip-worktree in Git
Filed under Programming
Learn the differences between the —assume-unchanged and —skip-worktree options of Git’s update-index command.
Cannot Connect to a Docker Daemon
Filed under Docker
Learn about the frequently encountered Docker daemon connectivity issue.
How to Create a New Entry in a Map
Filed under Java Collections
Learn how to use Java’s built-in classes, third-party libraries, and a custom implementation to create an Entry object in a Map.
A Guide to Maven Artifact Classifiers
Filed under Maven
Learn about artifact classifiers in Maven and understand the various scenarios where they are useful.
Java Weekly, Issue 426
Filed under Weekly Review
Spring Data 3.0, avoiding stringly typed Kotlin, ID generation in JPA, dockershim removal, and quantum computing.
Check if a User Is Logged-in With Servlets and JSP
Filed under Security
Learn how to use Servlets and JSPs to ensure a user is authenticated and has started a valid session before accessing any resources.
Java Missing Return Statement
Filed under Java
Explore some examples of missing return statements in Java.
Enable Logging for Spring Security
Filed under Logging, Spring Security
Leran how to modify the Spring Security logging level
Producer-Consumer Problem With Example in Java
Filed under Algorithms, Java Concurrency
A quick and practical guide to Producer-Consumer problem in Java.
How to Invert a Map in Java
Filed under Java Collections
Learn different options to invert a Map in Java.
GraphQL vs REST
Filed under REST, Web Services
GraphQL and REST can be used to enable the same integrations between different parts of our systems. We compare the two approaches to see how they have benefits in different situations.
How to Include Files Outside of Docker’s Build Context
Filed under Docker
By default, Docker expects to find all files for a build in the vicinity of the Dockerfile. We look at some options for pulling files from other parts of the filesystem, allowing us to split our Docker scripts from their dependencies.
Looking for a Java Developer with Spring Experience (Remote) (Part Time) (not open)
Filed under Spring
Looking for a Java Dev with Spring experience to join the Baeldung team.
Create an Empty Map in Java
Filed under Java Collections
Learn how to create empty maps in Java
Spring Security – Configuring Different URLs
Filed under Spring Security
Learn how to configure URL security access.
Document Enum in Swagger
Filed under Spring Web
Learn how to document enum in Swagger using the Maven plugin and verify the generated JSON document in the Swagger editor.
Spring @Autowired Field Null – Common Causes and Solutions
Filed under Spring
Learn about an error that would cause a NullPointerException when we unintentionally mix Spring injection with objects we create by calling their constructors.
Java Weekly, Issue 425
Filed under Weekly Review
Configurable card tables in Java GCs, Meet System Logger, configuring Spring Boot apps, serializability in practice, and 12-factor apps!
Gradle: sourceCompatiblity vs targetCompatibility
Filed under Gradle
Understand the difference between sourceCompatiblity and targetCompatibility Gradle parameters.
Error: “trustAnchors parameter must be non-empty”
Filed under Security
Learn the reasons for the error: “java.security.InvalidAlgorithmParameterException: trustAnchors parameter must be non-empty” and how to fix it
Reset/Disable Jenkins Security Settings From Command Line
Filed under DevOps
Learn about different approaches to regain access to the Jenkins console after losing the password.
Configure and Use Multiple DataSources in Spring Boot
Filed under Spring Boot, Spring Persistence
Learn how to configure multiple data sources with Spring Boot.
Java Weekly, Issue 424
Filed under Weekly Review
ForkJoinPool and parallelism, Embeddable in Hibernate 6, Java annotations, AWS in IntelliJ, free K8S cluster, and ML meet BigQuery!
Java ArrayIndexOutOfBoundsException
Filed under Java Collections
Learn what causes ArrayIndexOutOfBoundsException in Java and common techniques to avoid it.
Customizing Zuul Exceptions
Filed under Spring Cloud
An example of Zuul filter creation.
Setting Example and Description with Swagger
Learn how to use Swagger annotations to make documentation more descriptive and readable.
Hibernate Validator Annotation Processor in Depth
Filed under Persistence
When using the Java constraints library, it’s easy to make a mistake with an annotation and only find out about it at runtime. We look at the available annotation processor and how it can give us early feedback.
Printing Thread Info in Log File Using Log4j2
Filed under Logging
Learn how to print thread info using Log4j2
Get Current Trace ID in Spring Cloud Sleuth
Filed under Spring Cloud
Learn how to get current trace and span ID in Spring Cloud Sleuth.
Java Weekly, Issue 423
Filed under Weekly Review
From the next version of Maven, through measuring parallelism and all the way to core Agile principles. An interesting week.
An Introduction to Domain Graph Service (DGS) Framework
Filed under Spring Boot
Learn how to use the Domain Graph Service (DGS) Framework from Netflix to build a simple Spring Boot GraphQL service in Java.
Get Last Inserted Document ID in MongoDB With Java Driver
Filed under NoSQL, Persistence
Learn about MongoDB document IDs and how to retrieve the ID of a document we just inserted in a collection via a Java program.
Javadoc: @see, @link, and @inheritDoc
Filed under Java
A comparison between the @see and @link Javadoc annotations.
Java Weekly, Issue 422
Filed under Weekly Review
GraalVM release, composition vs inheritance in JPA, Gradle plugins, finding performance regressions at scale, and beautiful technical debt.
Change Cell Font Style with Apache POI
Filed under Data
Learn how to modify the font style of cells in a Microsoft Excel document
Adding EventHandler to JavaFX Button
Filed under Java
Learn how to add a handler event to a button for a JavaFX interface.
What Is the Difference Between NIO and NIO.2?
Filed under Java
Understand Java IO functionalities and how they changed throughout different Java versions.
Testing LDAP Connections With Java
Filed under Security
Learn how to test an LDAP server using a Java client
How to Access EntityManager with Spring Data
Filed under Spring Data
Learn how to access the EntityManager directly when working on a Spring Data application.
Java IdentityHashMap Class and Its Use Cases
Filed under Java Collections
Learn how to use IdentityHashMap in Java
Generating a Secure AES Key in Java
Filed under Security
A quick and practical guide to generating a secure AES key in Java.
Java Weekly, Issue 421
Filed under Weekly Review
Revisiting transactional, dynamic, and partial updates, JPA flush modes, Kafka vs Chronicle, and the real cost of attrition!
Cassandra Batch in Cassandra Query Language and Java
Filed under Data
Learn about the Cassandra batch query and how to apply it in Cqlsh and Java using BatchStatement.
Get the Name of the Currently Executing Test in JUnit
Filed under Testing
Sometimes we need our unit tests to be able to access the name JUnit has allocated to them. This is especially useful when using name generators or parameterized tests. We look at how to solve this problem in both JUnit 4 and 5.
Convert a Maven Build to Gradle
Learn how to convert a Maven build to a Gradle build.
Find All Jars Containing Given Class
Filed under Java
In this article, we’ll learn to find all the jars containing a particular class.
Hidden Classes in Java 15
Filed under Java
A quick and practical guide to Java 15’s Hidden Classes.
An Introduction to InstantSource in Java 17
Filed under Java
Learn all about the InstantSource interface introduced in Java 17. Understand what problems it addresses, and how to use it.
Java Weekly, Issue 420
Filed under Weekly Review
All about distributed systems: fault tolerant JVM, circuit breaker for RestTemplate, tracing in Spring Boot and replicated log. Also, catching errors in Java and risk of micro-dependencies!
Running a TestNG Project From the Command Line
Filed under Testing
TestNG is a unit testing library which can be run via the IDE and build tooling. We look at how to run TestNG tests directly with the command line.
Generating a Java String of N Repeated Characters
Filed under Java
Producing a string out of repeating a character or sequence can be done a variety of ways. We look at a few methods, and compare them for readability and efficiency.
SequenceInputStream Class in Java
Filed under Java
A quick and practical guide to Java SequenceInputStream class.
Keycloak Integration – OAuth2 and OpenID with Swagger UI
Filed under Security
Learn how to test a REST service that uses Keycloak for authentication and authorization with Swagger UI
Java Weekly, Issue 419
Filed under Weekly Review
Happy New Year 🙂
An interesting set of articles this week, from HTTP to persistence optimization and some Dilbert.
String equals() Vs contentEquals() in Java
Filed under Java
Learn the differences between the equals() and the contentEquals() methods of the String class in Java using practical examples.
Working with (Unknown Source) Stack Traces in Java
Filed under Java
Learn why we see an unknown source in our Java exception stack trace and how can we fix it.
A Brief History of the Java Programming Language
Filed under Java
Learn about the history of Java.
Multiple Line Code Example in Javadoc Comment
Filed under Java
A quick and practical tutorial to embedding code samples in JavaDoc comments.
Volatile Variables and Thread Safety
Filed under Java Concurrency
Learn why declaring a shared variable as volatile does not always guarantee thread-safety.
Replication Strategies and Partitioning in Cassandra
Filed under NoSQL
A quick and practical overview of replication strategies in Cassandra.
Why Maven Uses a Different JDK
Filed under Maven
Learn why Maven might use a different version of Java than the default one set in the system
Java Weekly, Issue 418
Filed under Weekly Review
State of Valhalla, Quarkus 2.6, Native Spring, new coroutine release, Qodana code quality, and the holy grail of keyboard layouts! A good way to end the year 🙂
Set the Name of a Thread in Java
Filed under Java Concurrency
Learn to set a Thread name in Java.
Remove a Large File from Commit History in Git
Filed under Programming
Learn how to remove large files from the commit history of a git repository using various tools.
Numeric Format Using POI
Filed under Data
Learn how to format numeric cells in Excel using Apache POI
Is Cassandra a Column-Oriented or Column-Family Database?
Filed under NoSQL
Learn how Cassandra stores data in a partitioned row store and how this differs from a column-oriented data store.
Java Weekly, Issue 417
Filed under Weekly Review
Kotlin extension and delegations, Spring Boot 2.6, custom JPA repositories, open-source dilemma, and microservices vs monoliths!
Guide to JBang
Filed under DevOps
Learn how to create, edit and run self-contained source-only or binary Java programs with ease using JBang.
Remove Duplicate Dependencies with Maven
Filed under Maven
Learn how to detect duplicate dependencies in Maven using the mvn dependency:tree and mvn dependency:analyze-duplicate commands.
Speed up Spring Boot Startup Time
Filed under Spring Boot
Learn different configurations and setups that can help decrease Spring Boot startup time.
Java HTTPS Client Certificate Authentication
Filed under Security
Learn how to use HTTPS Client Certificate Authentication in Java
Java Weekly, Issue 416
Filed under Weekly Review
All about log4j RCE exploit, Spring Boot remedies for log4j, building native images in Quarkus, and a new AWS region in Jakarta.
Check if an Enum Value Exists in Java
Filed under Java
Learn various ways to search enums in Java.
Java Implicit Super Constructor is Undefined Error
Filed under Java
Learn about Java’s “implicit super constructor is undefined” error and how to resolve it
Lombok Using @With Annotations
Filed under Java
Learn how to make copies of immutable objects with changes to only a single property using Lombok.
Generate PDF from Swagger API Documentation
Filed under REST
Learn how to generate a PDF document from an OpenAPI Swagger definition using Maven plugins and the online Swagger To PDF tool.
Java Weekly, Issue 415
Filed under Weekly Review
Migrating to Java 17, i18n in Spring Boot, naming strategies in Hibernate 5, simple web server, and fully-managed load testing on Azure. Good stuff as we’re getting closer to 2022.
Reading Values From Excel in Java
Filed under Java
Learn how to access different cell values using Apache POI.
Getting a Bit at a Certain Position from Integral Values
Filed under Java
We may need to test whether the binary digits of a number are set. We explore how to do this for any digit in an integer, using some optimised binary maths as well as some simpler alternatives.
Add an Image to a Cell in an Excel File With Java
Filed under Java
Apache POI allows us to build Excel spreadsheets from Java code. In this tutorial we look at the steps for adding images to our spreadsheets.
Convert a ByteBuffer to String in Java
Filed under Java
A quick and practical guide to ByteBuffer -> String conversion in Java.
JMX Ports
Filed under Java
Learn which ports are opened by JMX on startup
Java Weekly, Issue 414
Filed under Weekly Review
Modeling relations in Mongo, Java performance tips, new features in Java, warming caches at Netflix’s scale and reimagining software architecures!
Concatenating Null Strings in Java
Filed under Java
Learn various approaches to avoid null String objects while concatenating Strings in Java.
415 Unsupported MediaType in Spring Application
Filed under Spring MVC
In this tutorial, we’re going to showcase the causes and resolutions of the HTTP response code 415 Unsupported MediaType for POST requests in a Spring Application.
Quarkus Bean Discovery With Jandex Indexing
Filed under DevOps
In this article, we’ll learn the difference between bean discovery in Quarkus and classic Jakarta EE environments.
Java Weekly, Issue 413
Filed under Weekly Review
Java bridger, GC improvements in Java, Kotlin 1.6, native images, hashing in Java, full-stack Spring Boot, and K8S operators!
Testing NoSQL Queries With Spring Boot and @DataCassandraTest
Filed under Data, Spring Boot
Learn how to test a Cassandra database slice of a Spring Boot application using the Spring @DataCassandraTest annotation.
Importing Maven Project into Eclipse
Filed under Maven
Learn how to import a Maven project into Eclipse.
Get all the Keys in a JSON String Using JsonNode
Filed under Jackson
Learn different ways to read key names from JSON content.
Add Borders to Excel Cells With Apache POI
Filed under Java
Explore how to generate a variety of cell borders using CellRangeAddress, RegionUtil, BorderStyles, and IndexedColors classes.
Removing Docker Containers
Filed under Docker
Learn why it is necessary to remove Docker containers.
Declaring Val and Var Variables in Lombok
Filed under Java
Learn how to use Lombok’s val and var to define local variables without specifying the type.
Omitting Getter or Setter in Lombok
Filed under Java
Learn how to skip the generation of individual getters and setters when using Lombok annotations.
HMAC in Java
Filed under Security
Learn how to work with the HMAC algorithm in Java.
Java Weekly, Issue 412
Filed under Weekly Review
Large objects and GC in Java 18, new API in project loom, native images for Spring Boot, AWS MemoryDB, and building an startup!
Set Background Color of a Cell with Apache POI
Filed under Data
Learn how to change the cell background color in Excel using Apache POI.
Constructors in Java Abstract Classes
Filed under Java
A quick and practical guide to using constructors in abstract classes.
Ignoring Commas in Quotes When Splitting a Comma-separated String
Filed under Java
Learn various approaches for ignoring commas in quotes when splitting a comma-separated String.
Solving Certificate Store Errors in JVM
Filed under Security
In this tutorial, we’ll take a look at common issues we might encounter when issuing SSL requests.
Spring Webflux and @Cacheable Annotation
In this article, we’ll explain how Spring WebFlux interacts with @Cacheable annotation
Assert That a Java Optional Has a Certain Value
Filed under Testing
We may need to write assertions on Optional values. We explore a few ways to do this, both with JUnit assertions and with the AssertJ library.
What Is OncePerRequestFilter?
Filed under Spring Web
Learn how to use the Spring OncePerRequestFilter to ensure your filter code is executed only once for each request.
Java Weekly, Issue 411
Filed under Weekly Review
Bulk updates in Spring Data JPA, Java HTTP Clients, Hibernate Reactive, feature flags in Spring Boot, and non-root containers in K8S!
Request Routing and Snitches in Cassandra
Filed under Programming
Learn about the job of a snitch and how Cassandra uses it to efficiently route requests.
Check if the First Letter of a String Is Uppercase
Filed under Java
Explore different solutions for checking if the first letter is uppercase.
Nested HashMaps Examples in Java
Filed under Java Collections
Learn how to create, compare, update and flatten a nested HashMap.
List All the Classes Loaded in the JVM
Filed under Java
Learn different techniques to list all classes loaded in the JVM
Initialization Vector for Encryption
Filed under Security
Learn how to use an Initialization Vector (IV) with encryption algorithms and the best practices while using the IV
Split a String Only on the First Occurrence of Delimiter
Filed under Java
Learn two approaches to split a String only on the first occurrence of a delimiter in Java.
Serialization Validation in Java
Filed under Java
Learn about validating serializable objects in Java.
New Features in Java 17
Filed under Java
In this article, we’ll talk about the news related to the new version of the Java ecosystem, Java SE 17 – the new features and the changes in its release process, LTS support, and licenses.
Guide to Garbage Collector Roots
Filed under Java
Learn what GC roots are and their usage in the garbage collection process
Introduction to HexFormat in Java 17
Filed under Java
Learn how easy it is to convert between bytes and hexadecimal strings with the updated HexFormat class in Java 17.
How to Get Docker-Compose to Always Use the Latest Image
Filed under Docker
In this tutorial, we’ll check out several options to ensure that docker-compose always uses the latest images of the applications.
Java Weekly, Issue 410
Filed under Weekly Review
Finalizer deprecation, string improvements in Java 17, Kotlin support in protocol buffers, cache libraries on JVM, and software engineering principles.
Splitting a Java String by Multiple Delimiters
Learn different options for splitting an input string by multiple delimiters using regular expressions, Google Guava, and Apache Commons
What Is the –release Option in the Java 9 Compiler?
Filed under Java
Learn about Java 9’s new command-line compiler option –release, what it does and how to use it.
Remove Beginning and Ending Double Quotes from a String
Filed under Java
Learn different approaches for removing the beginning and ending double quotes from a String in Java.
Java Weekly, Issue 409
Filed under Weekly Review
Hibernate Reactive goes GA, caching, Record serialization, no more Dockerfiles with Paketo, and embracing mob programming!
Multiline Text in Excel Cell Using Apache POI
Filed under Data
Learn how to add multiline text to a cell using Apache POI.
Java Map – keySet() vs. entrySet() vs. values() Methods
Filed under Java Collections
Learn how to use the keySet(), entrySet() and values() methods of the Map interface in Java.
States of a Docker Container
Filed under Docker
Explore different states of a Docker container.
Getting a Character by Index From a String in Java
Filed under Java
Learn how to get the character at a given position of a String in Java.
Java Weekly, Issue 408
Filed under Weekly Review
Serialization filters, cold starts in JVM, faster charset encoding, simple web server, JDBC caching, and specialized kube-proxies!
Parallel Test Execution for JUnit 5
Filed under Testing
In this article, we’ll cover how to execute parallel unit tests using JUnit 5.
Remove Accents and Diacritics From a String in Java
Filed under Java
This article explains what Unicode text normalization is, how to remove accents and diacritical marks in text, and the pitfalls to watch out for.
Format Swagger Text Descriptions
Filed under REST
A quick and practical guide to formatting Swagger descriptions.
Remove an Entry from a Java HashMap
Filed under Java
Learn different ways to remove an entry from a Java HashMap.
Convert a Byte Array to a Numeric Representation in Java
Filed under Java
Explore different approaches to convert a byte array to a numeric value and vice versa in Java.
Environment Variable Prefixes in Spring Boot 2.5
Filed under Spring Boot
Learn how to use a prefix for environment variables with Spring Boot.
Java Weekly, Issue 407
Filed under Weekly Review
Faster Maven builds (always good), how SREs scale in an org, and a cool Datadog feature. A solid week overall.
Using Fail Assertion in JUnit
Filed under Testing
Explore practical use cases for the fail assertion in JUnit.
Get a Field’s Annotations Using Reflection
Filed under Java
Learn how to get a field’s annotations and how the retention meta-annotation works
Update the Value Associated With a Key in a HashMap
Filed under Java Collections
Learn several methods for updating the value associated with a HashMap key using core Java.
Trusting All Certificates in OkHttp
Filed under HTTP Client-Side
Learn how to create an OkHttpClient and configure it to trust all certificates — not the best practice in production, but you may need it from time to time during development or testing.
Cassandra Frozen Keyword
Filed under NoSQL, Persistence
Learn about the frozen keyword in Apache Cassandra and how to create frozen collections and user-defined types.
Spring Boot vs Quarkus
Filed under Spring
A practical comparison between Spring Boot and Quarkus, with a focus on performance.
Generate a WAR File in Maven
Filed under Maven
In this tutorial, we’re going to consider the usage of the Maven WAR plugin with a Java EE application.
Hibernate’s “Object References an Unsaved Transient Instance” Error
Filed under Persistence
Learn how to define a proper CascadeType to solve the “org.hibernate.TransientObjectException: object references an unsaved transient instance” error
Java Weekly, Issue 406
Filed under Weekly Review
ZGC is even better in Java 17, faster Maven builds, BGP and Facebook, pattern matching future, and economy of code ownership!
Error Handling in gRPC
Filed under Java
Learn how to implement error handling in gRPC for unary and stream-based RPC calls.
Using a Custom Class as a Key in a Java HashMap
Filed under Java Collections
Learn how to use custom classes as keys in Maps in Java.
Get the Last Word of a String
Filed under Java
A quick and practical overview of getting the last word of a String in Java.
Convert Long to String in Java
Filed under Java
A quick and practical overview of converting Long to String in Java.
Spring Security – Request Rejected Exception
Filed under Spring Security
Explore Spring Security’s protection against malicious URLs that may cause the Path Traversal/Directory Traversal attacks.
Java Weekly, Issue 405
Filed under Weekly Review
Spring configurations, Java 18 snippets, Spring 6, Micronaut 3.0, Netflix’s media packaging, and atomic habits for software engineers!
Add a Reference to Method Parameters in Javadoc
Filed under Java
Learn how to create references to method parameters in Javadoc.
JUnit 4 on How to Ignore a Base Test Class
Filed under Testing
Learn possible solutions to skip running tests from base test classes in JUnit 4
Email Validation in Java
Filed under Java
Learn how to validate email addresses in Java using regular expressions.
Share Docker Images Without Using the Docker Hub
Filed under Docker
Learn about the Docker save and load commands and how to transfer a Docker image using these commands.
Get a Submap From a HashMap in Java
Filed under Java Collections
A quick and practical guide to deriving a submap from a HashMap in Java.
Consistency Levels in Cassandra
Filed under NoSQL, Persistence
Learn about consistency levels in Cassandra.
Java Weekly, Issue 404
Filed under Weekly Review
GC improvements in Java 17, better Foreign Memory API, Spring Boot scheduling, javac Trees, A/B testing at Netflix, and more from K8S 1.22.
Streaming with gRPC in Java
Filed under Programming
A quick and practical guide to gRPC streaming in Java.
Undo and Revert Commits in Git
Filed under Programming
Learn the safest way to undo or revert commits in a Git repository.
Java Sound API – Capturing Microphone
Filed under Java
Learn how to capture microphone input and save it to a file.
Maven dependencyManagement vs. dependencies Tags
Filed under Maven
Learn the similarities and differences of Maven’s dependencyManagement and dependencies tags
Fixing the “Declared package does not match the expected package” Error
Filed under Java
If the package name of a java file does not match its location on the file system, we’ll get an error. We look at a few common causes for this and how to fix it.
HTML to PDF Using OpenPDF
Filed under Data
Learn how to convert HTML to PDF in Java using OpenPDF and Flying Saucer or using the Open HTML to PDF library, with a little help from Jsoup.
Collecting Stream Elements into a List in Java
Filed under Java Collections
Learn how to collect Stream elements into a List in different versions of Java, and the pros and cons of the approaches.
Get All Running JVM Threads
Filed under Java
A quick and practical guide to listing all JVM threads.
Different Log4j2 Configurations per Spring Profile
Filed under Spring
A quick and practical guide to configuring different Log4j2 configs per Spring profile.
Java Weekly, Issue 403
Filed under Weekly Review
Java 17 is released, more LTS versions for Java, Java modules, Spring without annotation, Netflix’s API Gateway, and exotic timezones!
Priority of a Thread in Java
Filed under Java Concurrency
Learn about Thread priority values in Java, how to set them, and how the Java scheduler uses them to prioritize threads to execute.
Performance of System.arraycopy() vs. Arrays.copyOf()
Filed under Java Collections
Learn about the implementation and performance of System.arraycopy() and Arrays.copyOf()
Guide to mapMulti in Stream API
Filed under Java
A quick and practical guide to the new Stream.mapMulti method in Java.
Generate a Java Class From JSON
Filed under JSON
Learn how to create a Java class from a JSON object using the jsonschema2pojo library
Java Weekly, Issue 402
Filed under Weekly Review
Ready for Java 17? Spring baselining on Java 17, migration tips, and IntelliJ support. Also, more efficient gRPC, 10 years of Kotlin, and simplifying hard tasks!
Enabling Unlimited Strength Cryptography in Java
Filed under Security
Learn why and how to enable unlimited strength cryptography in different versions of Java.
Understanding Maven’s “relativePath” Tag for a Parent POM
Filed under Maven
Learn about the Parent POM resolution of Maven.
Connecting to a Specific Schema in JDBC
Filed under Persistence
In this article, we’ll cover the basics of database schemas, why we need them, and how they are useful. After that, we’ll focus on practical examples of setting schema in JDBC with PostgreSQL as a database.
Find the IP Address of a Client Connected to a Server
Filed under Networking
We can find the address of a client connected to our application by using the APIs within the java.net package. We look at establishing a TCP socket and understanding its properties.
Understanding Detached HEAD in Git
Filed under Programming
Explore what a detached HEAD in Git is and how it works.
Javadoc: @version and @since
Filed under Java
In this tutorial, we’ll focus on the @version and @since tags in Javadoc.
Test WebSocket APIs With Postman
In this article, we’ll create an application with WebSocket and test it using Postman.
Java Weekly, Issue 401
Filed under Weekly Review
Plans for Spring 6.0, structured logging, subtleties of soft-deletion in Hibernate, event-sourcing at Netflix, GCToolkit from Microsoft, and beautiful Powershell!
Format a Milliseconds Duration to HH:MM:SS
Filed under Java
Learn how to use Java’s Duration, TimeUnit, and third-party libraries to format a duration to a specific format
The DTO Pattern (Data Transfer Object)
Filed under Architecture
Explore the definition of the DTO Pattern and its reason for existing, and how to implement it.
Java Weekly, Issue 400
Filed under Weekly Review
Micronaut 3 is released, Spring IoC, source code snippets in Java 18, panache repository pattern, filtering out syscalls in K8S, and climate change!
Gradle Offline Mode
Filed under Gradle
Learn how to use Gradle in offline mode, whether you’re working from the command line, IntelliJ IDEA, or Eclipse.
Custom Serializers in Apache Kafka
In this tutorial, we’ll see how to implement Kafka default format converters and custom serializers for specific use cases.
Cassandra Partition Key, Composite Key, and Clustering Key
Learn how a partition key, composite key, and clustering key form a primary key and also how they differ
Run JUnit Test Cases From the Command Line
Filed under Testing
Learn how to run JUnit 5 tests directly from the command line with and without Maven
Display Custom Items in JavaFX ListView
Filed under Java
Explore a way to show custom items in JavaFX ListView.
Deploying a Java War in a Docker Container
Filed under Docker
Learn how to deploy a Java WAR file in a Docker container using the official Tomcat Docker image
Change the Default Location of the Log4j2 Configuration File in Spring Boot
Filed under Spring Boot
Learn different ways to change the default location of the Log4j2 configuration file in Spring Boot.
Java Weekly, Issue 399
Filed under Weekly Review
A cool interview with Java architects, Vector API, getting the most out of Hibernate, K8S with more windows, and continuous configuration with AWS!
Compare the Content of Two Files in Java
Filed under Java
A quick and practical guide to comparing the contents of two files in Java.
Inserting Delays Between Requests in Apache JMeter
Filed under Testing
To simulate user activity, we often need to add timing to our JMeter configuration. We explore how to build a test plan with gaps between actions.
Java Weekly, Issue 398
Filed under Weekly Review
Java 16 new features, reflection meets method handles, active record panache, gateway pattern, and swapping in K8S.
Throwing Exceptions in Constructors
Filed under Java
Learn about throwing exceptions in a constructor.
Hosting a Maven Repository on GitHub
Filed under Programming
A quick and practical guide to hosting Maven repositories on GitHub.
Java Annotation Attribute Value Restrictions
Filed under Java
Learn some reasons for this limitation and look under the hood of the JVM to explain it better
Java Weekly, Issue 397
Filed under Weekly Review
Project Loom vs Reactive Programming, GraalVM improvements, Spring Data Projections, feature parity pattern, and a new K8S release!
Looking for a Java Team Lead with Spring Experience (Remote) (Part Time) (not open)
Filed under Java
Senior Java developer role
Difference Between MVC and MVP Patterns
Filed under Architecture
Learn about the differences between the MVC and MVP Patterns.
How to Create Password-Protected Zip Files and Unzip Them in Java
A quick and practical guide to working with password-protected ZIP files in Java.
EntityNotFoundException in Hibernate
Filed under Persistence
Explore situations when EntityNotFoundException occurs and solutions to handle it.
Setting Up a Jenkins Slave Node
Filed under DevOps
Understand the concept of distributed builds in Jenkins Architecture and how we can configure Jenkins master-slave architecture.
Default Values for Maven Properties
Filed under Maven
In this short article, we’ll go through how to configure Maven properties default values, and how to use them.
Calling a SOAP Web Service from the Command Line
Filed under Programming
A quick and practical guide to calling SOAP WebServices from the command line.
Linking to an External URL in Javadoc
Filed under Java
Learn how to use Javadoc to link to external urls.
Java Weekly, Issue 396
Filed under Weekly Review
Java’s 6-month cadence dilemma, Panache versatility, retrying with Resilience4j, testing in Spring Boot, and a new major Cassandra version.
CQL Data Types
Filed under NoSQL, Persistence
Learn about some of the different data types of the Apache Cassandra database.
Find Whether an IP Address Is in the Specified Range or Not in Java
Filed under Networking
Learn how to check if an IP address is in a given range in Java.
Java Weekly, Issue 395
Filed under Weekly Review
Tunneling to Rust from Java, RabbitMQ streams, fewer releases for K8S, and why agile transformation fails!
Significance of Getters and Setters in Java
Filed under Java
Explore the pros and cons of using getters and setters in Java.
Valid @SuppressWarnings Warning Names
Filed under Java
A quick and practical guide to @SuprressWarnings and its parameters.
Convert a String to Camel Case
Filed under Java
Camel case text conversion can be achieved by using regular expressions, or via some library functions. We look at a couple of implementations we can add to our own code, and a couple of examples from libraries.
Guava’s Futures and ListenableFuture
Filed under Guava, Java Concurrency
Learn about Guava’s support in async programming: Futures and ListenableFuture
Creating a Self-Signed Certificate With OpenSSL
Filed under Security
A quick and practical guide to creating self-signed certificates with OpenSSL.
Java Weekly, Issue 394
Filed under Weekly Review
Quarkus and Hibernate, Kotlin internal, the road to K8S 1.22, Elasticsearch meets Amsterdam, and the messy IoT world!
Writing Log Data to Syslog Using Log4j2
Filed under Logging, Spring Boot
Learn to write log data to Syslog using Log4j2 and Spring Boot.
Guide to Java BigInteger
Filed under Java
Learn about the implementation details of the BigInteger class in Java.
Additional Source Directories in Maven
Filed under Maven
Learn how to configure additional source directories in Maven.
Converting String to BigInteger in Java
Filed under Java
Learn to convert a String to a BigInteger in Java.
Java Weekly, Issue 393
Filed under Weekly Review
Quarkus 2.0, GraphQL meets Spring, experimenting with GitHub’s copilot, read-only hints for Hibernate, and uncovering better ways for working!
Count Occurrences Using Java groupingBy Collector
Filed under Java
Learn how to use Collector.groupingBy() to group the equal objects.
The java.lang.NoClassDefFoundError in JUnit
In this article, we’ll understand why the java.lang.NoClassDefFoundError occurs in JUnit and how to fix it.
Send Large Messages With Kafka
Filed under Data
A quick and practical explanation of how to send large messages with Kafka.
“Code too large” Compilation Error in Java
Filed under Java
Learn what causes the compiler error “code too large”, along with situations where we might encounter it and what we can do to fix it.
Different Serialization Approaches for Java
Filed under Java
Learn several approaches for serializing Java objects using third-party libraries or core Java’s built-in serialization API.
JPA Entities and the Serializable Interface
Filed under Persistence
Learn when and why to use the Serializable interface in JPA entities according to the JPA specification.
Swagger @Api Description Is Deprecated
Filed under REST
Learn alternatives to the deprecated description attribute with Swagger 2 and OpenAPI 3.
Kubernetes Deployment vs. StatefulSets
In this tutorial, we’ll discuss two different ways to deploy our application(pods) on Kubernetes using two resources provided by Kubernetes: Deployment and StatefulSet.
Java Weekly, Issue 392
Filed under Weekly Review
Busy week for Spring projects, Hibernate physical naming strategy, Spring-ified ElastiCache, clocks in distributed systems, and Istio to the rescue!
Expose More Than One Port With Docker
Filed under Docker
Learn how to declare more than one port to expose and how to bind the exposed ports with the ports of the host computer
Enabling Logging for Apache HttpClient
Filed under HTTP Client-Side
Learn how to enable logging for the Apache HttpClient.
Generating Alphanumeric UUID String in Java
Filed under Java
A practical comparison of various UUID generation methods in Java.
Private Constructors in Java
Filed under Java
Learn about private constructors in Java.
Running Selenium Scripts with JMeter
Filed under Testing
Learn how to run a Selenium script using JMeter.
Cluster, Datacenters, Racks and Nodes in Cassandra
Explore the basic components of Cassandra’s architecture.
Logical vs Bitwise OR Operator
Filed under Java
Java supports two variations of OR with different operator precedence and runtime behaviour. We explore how logical OR short-circuits and how bitwise OR applies to numbers and boolean values.
How to Get the Number of Threads in a Java Process
Filed under Java Concurrency
Learn how to check the number of threads created by a Java process.
Java Weekly, Issue 391
Filed under Weekly Review
Going from imperative to the reactive paradigm, web standards, and the future of the internet. Good stuff.
A Comparison Between JPA and JDBC
Filed under Persistence
Learn about the differences between JPA and JDBC.
Java DocLint
Filed under Java
Learn how to use Java DocLint to analyze your Javadoc.
What Does Mono.defer() Do?
Filed under Reactive
Learn about Monod.defer() and how it is related to lazy and eager evaluation.
Connection Timeout vs. Read Timeout for Java Sockets
Filed under Java, Networking
Learn about the timeout exceptions of Java socket programming
Command Line Arguments as Maven Properties
Filed under Maven
In this short tutorial, we’ll look at how we can pass arguments to Maven using the command line.
Java Weekly, Issue 390
Filed under Weekly Review
New Boot and Java goodness – things are certainly moving fast. And our last COVID launch started yesterday.
Wire Tap Enterprise Integration Pattern
Filed under Architecture
A guide to the Wire Tap Enterprise Integration Pattern (EIP)
Max-HTTP-Header-Size in Spring Boot 2
Filed under Spring Boot
Learn how to set and use the max-http-header-size property in a Spring Boot 2.x application.
Referencing a Method in Javadoc Comments
Filed under Java
Learn to reference a method in Javadoc comments.
Guide to Jenkins Architecture and Performance Improvements
Filed under DevOps
Learn how we can configure Jenkins to improve its performance.
Mask Sensitive Data in Logs With Logback
Learn how to use the PatternLayout feature to mask sensitive data in application logs with Logback
Java – Path vs File
Filed under Java
Learn about the differences between the File and Path classes in Java.
JPA Support – State of the Tools Ecosystem in 2021
Filed under Persistence
An overview of the JPA plugins available for IntelliJ and Eclipse
Non-Capturing Regex Groups in Java
Filed under Java
Explore how to use non-capturing groups in Java Regular Expressions
Java Weekly, Issue 389
Filed under Weekly Review
JFR mirror events, testing RSocket, deep dive in SQL execution plans, eBPF at Netflix, and space exploration with AWS!
Local JAR Files as Gradle Dependencies
Filed under Gradle
Learn how we can add local JAR files to our Gradle dependencies.
Inserting Null Into an Integer Column Using JDBC
Filed under Persistence
Learn how to store null values in a database using plain JDBC.
Understanding the Pattern.quote Method
Filed under Java
When using regular expressions in Java, sometimes we need to match regex patterns in their literal form – without processing any metacharacters. Let’s find out how we can do that.
Spring Validation in the Service Layer
Filed under Spring
A quick and practical introduction to service layer validation in Spring.
Log4j Warning: “No Appenders Could Be Found for Logger”
Filed under Logging
Learn why the Log4j warning, “No appenders could be found for logger” occurs and how to resolve it, both in configuration and in Java code.
Java Weekly, Issue 388
Filed under Weekly Review
Safe natives in Java, secure microservices with Spring Security, continuous testing in Quarkus, AWS timeseries, and different test levels!
Kafka Streams vs. Kafka Consumer
Filed under Data
Learn how Kafka Streams simplify the processing operations when retrieving messages from Kafka topics.
Defining Unique Constraints in JPA
Filed under Persistence
Learn how to define unique constraints on entity classes in JPA and Hibernate.
Attach and Detach From a Docker Container
Filed under Docker
A Docker container can be run either attached to or detached from the terminal that launched it. We look at how to launch containers and how to retrospectively attach to running containers or detach the terminal without terminating them.
Finding All Classes in a Java Package
Filed under Java
Learn how to find all classes in a Java package at runtime.
Secret Key and String Conversion in Java
Filed under Security
A quick and practical introduction to secret key and string conversion in Java.
Java Weekly, Issue 387
Filed under Weekly Review
Spring Boot 2.5 is released, large pages on JVM, hacking JVM, mapMulti for streams, project loom, and a service-oriented language!
Downloading Email Attachments in Java
Filed under Java
Learn how we can download email attachments using the JavaMail API
Maximum Size of Java Arrays
Filed under Java
Learn about the maximum size of Java arrays.
IllegalAccessError in Java
Filed under Java
Learn about the java.lang.IllegalAccessError.
AliasFor Annotation in Spring
Filed under Spring
Learn about the @AliasFor annotation in the Spring Framework.
Guava Guide
Learn how to use Google Guava, the popular Java open-source library of common utilities
Java Weekly, Issue 386
Filed under Weekly Review
Kafka without ZooKeeper in action, type patterns in Java 17, JFR streaming, JPA entity graph, and applying ML to DevOps issues!
How to Display a Message in Maven
Filed under Maven
Learn how to print messages to the console or to a file during a Maven build using various plugins.
How to Implement a Soft Delete with Spring JPA
Filed under Spring Data
Physically deleting data from a table is usual when interacting with databases. But sometimes there are business requirements to not permanently delete data from the database.
In this tutorial, we’ll learn about soft delete and how to implement this technique with Spring JPA.
Converting String to BigDecimal in Java
Filed under Java
Explore multiple methods to convert String to BigDecimal values.
Build a Trading Bot with Cassandre Spring Boot Starter
Filed under Spring Boot
Learn how to create a strategy interacting with a crypto exchange and test it against historical data.
Overriding Column Definition With @AttributeOverride
Filed under Persistence
Learn how to use @AttributeOverride to change a column mapping
Split a String in Java and Keep the Delimiters
Learn how to split a string in such a way that the delimiters are part of the result
HandlerInterceptors vs. Filters in Spring MVC
Filed under Spring MVC
Compare the Java servlet Filter and the Spring MVC HandlerInterceptor and learn when one might be preferable over the other
Code Coverage with SonarQube and JaCoCo
Filed under Testing
A guide to measuring code coverage using SonarQube and JaCoCo.
Returning an Auto-Generated Id with JPA
Filed under Spring Persistence
In this tutorial, we’ll discuss how we can handle auto-generated ids with JPA.
Docker Guide
A collection of tutorials on Docker
Copying Files With Maven
Filed under Maven
Learn how to copy a source file to a destination using three different Maven plugins.
HTTP PUT vs. POST in REST API
Filed under REST, Spring Boot
Learn the differences between HTTP POST and PUT methods and when to use each in a RESTful API.
Java Weekly, Issue 385
Filed under Weekly Review
Non-blocking networking with Project Loom, teeing collector, Spring and AWS SQS, Kotlin 1.5, and strong consistency in AWS S3!
Using an Interface vs. Abstract Class in Java
Filed under Java
Learn when to use an interface and when to use an abstract class in Java.
Getting the Java Version at Runtime
Filed under Java
Learn to find the Java version at runtime.
Fixing the NoSuchMethodError JUnit Error
Filed under Testing
Learn how to fix the NoSuchMethodError and NoClassDefFoundError JUnit errors
How to Convert Mono<List<T>> Into Flux<T>
Filed under Reactive
Learn to convert a Mono of a collection to Flux of the collection’s items.
Java Weekly, Issue 384
Filed under Weekly Review
Superior Java records, Kotlin 1.5, code examples in Javadoc, stream collector, Spring Cloud Gateway meets K8S, indexing JSON columns, and COIVD predictions!
Converting a Java Keystore Into PEM Format
Learn how to convert certificates and private keys from a Java KeyStore into PEM format using keytool and openssl.
Java Weekly, Issue 383
Filed under Weekly Review
Backward compatibility and Javac, Micronaut hipster, faster Graal, life after SecurityManager, API gateway in K8S, and Bitcoin’s energy problem!
Introduction to Debezium
Filed under Data
Learn about CDC using Debezium and Java.
Convert an Array of Primitives to an Array of Objects
Filed under Java
Learn to convert an array of primitives to an array of objects.
Advise Methods on Annotated Classes With AspectJ
Filed under Java
Learn how to write trace logging output when calling methods of configured classes using AspectJ.
Set a Timeout in Spring 5 Webflux WebClient
Filed under HTTP Client-Side, Spring Web
Learn how to configure timeout settings for our WebClient using Spring Webflux.
Java Weekly, Issue 382
Filed under Weekly Review
Spring Data improvements, more from project Panama, delegation in Kotlin, deprecating security manager, clustered indices, and indexed jobs in K8S!
How to Handle InterruptedException in Java
Filed under Java Concurrency
Learn about Java’s InterruptedException, what causes it, and how to handle it.
Split Java String by Newline
Filed under Java
Learn different ways to split a Java String by newline characters
The package-info.java File
Filed under Java
Learn about the package-info.java file, what its purpose is, and how we can use it to specify package-level Javadocs and annotations.
Displaying Error Messages with Thymeleaf in Spring
Filed under Spring MVC
Learn how to build a simple Spring application to demonstrate how to display various types of errors in Thymeleaf.
Spring Bean Names
Filed under Spring
Learn about different Spring bean naming strategies.
Convert a Java Enumeration Into a Stream
Filed under Java Collections
In this short tutorial, we’re going to implement a utility method for converting Enumeration objects to the Java Stream API
Java Weekly, Issue 381
Filed under Weekly Review
A busy week for the Spring team, new JMC version, Microsoft loves OpenJDK, CronJobs on K8S, and introducing weakness-oriented hiring!
Usage of the Hibernate @LazyCollection Annotation
Filed under Persistence
Learn about the two main design patterns for fetching and how they relate to the @LazyCollection annotation in Hibernate
Java Weekly, Issue 380
Filed under Weekly Review
Microsoft’s OpenJDK, serializing records, rate-limiting with Spring, vector API, PodSecurityPolicy deprecation in K8S, and capturing two dimensions of time!
TLS Setup in Spring
Learn how to set up TLS in Spring.
Backpressure Mechanism in Spring WebFlux
Filed under Reactive
In this tutorial, we’ll explain what it is and how to apply backpressure mechanism in Spring WebFlux to mitigate it.
Java Technical Editor (part-time)
Filed under Java
Join the Baeldung editorial team.
Spring Boot With JavaServer Pages (JSP)
Filed under Spring Boot
Learn how to build a web application with Spring Boot and JSP.
Java Weekly, Issue 379
Filed under Weekly Review
Pattern matching meets switch expressions, working with lazy relationships, Spring Boot for serverless, the road to Kotlin 1.5 and Java 17, and tips for working from home!
Open API Server Implementation Using OpenAPI Generator
Filed under Spring
Learn how to generate a Spring-based server stub from a YAML specification using the OpenAPI generator’s Maven plugin.
Java Class File Naming Conventions
Filed under Java
Understand autogenerated class naming conventions in Java.
Count Query In jOOQ
Filed under Persistence
Learn different ways to perform a record count with jOOQ.
Java Weekly, Issue 378
Filed under Weekly Review
Primitive objects, more performant ZGC, trying Spring native, more secure Java 16, concurrency control approaches, and 15 years of S3.
Spring Reactive Guide
Filed under Reactive, Series, Spring Web
A series of tutorials on reactive programming support in Spring
Java Weekly, Issue 377
Filed under Weekly Review
Java 16 is released, official native images for Spring, backpressure, Jetty HTTP load generator, GitHub actions, and say no to SOLID!
Get All Endpoints in Spring Boot
Filed under REST, Spring Boot
Learn to find all endpoints for a Spring Boot REST application.
Clearing the Maven Cache
Filed under Maven
In this short tutorial, we’ll explore ways to clear our local Maven cache.
Spring Security OAuth Authorization Server
Filed under Spring Security
Learn how to use the Spring Security OAuth Authorization Server.
Java Weekly, Issue 376
Filed under Weekly Review
On Java 16 and beyond: Records, Vector API, Unix domain sockets, UTF-8 everything, and Project Valhalla. Also, slow queries with Hibernate, and Kind over minikube!
Guide to Purging an Apache Kafka Topic
Filed under Data
Explore a few strategies to purge data from an Apache Kafka topic
Java Weekly, Issue 375
Filed under Weekly Review
Deserialization events in JFR, more efficient G1, native images, Scala 3, pattern matching for primitives, merge join algorithm, and effective communication.
Invoking a Private Method in Java
Filed under Java
We sometimes need to access private methods from our code, especially our test code. In this tutorial we cover a couple of ways to make private methods accessible.
Insert a Row in Excel Using Apache POI
Filed under Data
Learn how to inser a new row between two rows in an Excel file using the Apache POI library
Converting Java Properties to HashMap
Filed under Java Collections
Let’s see how we can convert java.util.Properties into a HashMap
Java Weekly, Issue 374
Filed under Weekly Review
Streaming options, initializing testcontainers, faster charset decoding, DDD in Java, GraphQL microservices, and recipes for being an enabler manager!
Where Does Java’s String Constant Pool Live, the Heap or the Stack?
Filed under Java
Learn about the storage area for String constant pool.
Override Maven Plugin Configuration from Parent
Filed under Maven
While we want to modularise our maven file to avoid repetition, sometimes it’s necessary to provide specific variations for child modules. Here we explain how the various tiers of a maven file can be combined.
How To Configure Java Heap Size Inside a Docker Container
Filed under Docker
To run Java in a docker container we may need to set the correct memory allocation settings, or use a JVM which is aware that it is running in a container. We discover how to optimise a docker build for our Java application’s memory.
Configuring Message Retention Period in Apache Kafka
Learn how to configure time-based message retention properties for Kafka topics
Java Weekly, Issue 373
Filed under Weekly Review
Maven central security, breaking a monolith, quarkus testing, more efficient Md5, introducing latency in SQL queries, and chaos engineering!
File Upload With Open Feign
Filed under REST, Spring Cloud
Learn how to implement a Multipart File upload using OpenFeign.
Prevent Cross-Site Scripting (XSS) in a Spring Application
Filed under Spring Security
When writing a web service in Spring we need to create a custom filter in order to protect our services from cross-site scripting attacks. We explore how to achieve this using ESAPI and Jsoup.
Java Weekly, Issue 372
Filed under Weekly Review
Java 16 goes RC1, Unix-domain sockets, native images, jOOQ internals, metrics meets open tracing, joining tables with a hash-join algorithm, and having more effective meetings!
Java HashMap Load Factor
Filed under Java Collections
In this article, we’ll see the significance of the load factor in Java’s HashMap and how it affects the map’s performance.
Java Weekly, Issue 371
Filed under Weekly Review
Experimenting with Unix-domain sockets, more randomness, Java on Java, vectorization, the benefits of pull requests, and the story of Netflix’s homepage!
Multiple Submit Buttons on a Form
Filed under Spring MVC
Learn how to add another button to the same form in a Spring MVC application that maps to the same RequestMapping on the controller.
Using the Map.Entry Java Class
Filed under Java Collections
We often use maps to store a collection of key-value pairs. We explore the Entry objects inside a map and how to make the most of them.
Java Weekly, Issue 370
Filed under Weekly Review
Java turns 25, interview with Brian Goetz, scalable batching processing, more pattern matching, foreign memory access, idempotent consumers, and latency numbers for teams!
An Introduction to the Constant Pool in the JVM
Filed under Java
Learn about the constant pool in JVM.
Structural Patterns in Core Java
Filed under Architecture, Java
Learn how some core libraries in Java have adopted the seven core structural design patterns
Java Weekly, Issue 369
Filed under Weekly Review
Run Java on Java, reactive JAX-RS, inline and primitive objects, Java 17 new additions, state watch pattern, and guidelines for pair programming!
How to Analyze Java Thread Dumps
Filed under DevOps, Java Concurrency
Learn how to analyze thread dumps to efficiently diagnose performance issues. Also, we’ll learn to detect bottlenecks or even simple bugs.
How to Convert a Hibernate Proxy to a Real Entity Object
Filed under Persistence, Spring
In this tutorial, we’ll learn how to convert a Hibernate proxy to a real entity object
Evaluating a Math Expression in Java
Filed under Java
Learn how to evaluate math expressions expressed in String format in Java using exp4j, Javaluator, and the Java Scripting API.
Java Weekly, Issue 368
Filed under Weekly Review
Pattern matching and guards, fat JARs, Reactive Hibernate, HTTP clients and Project Reactor, timed leasing for distributed systems, and when to say No!
Determine if an Integer’s Square Root Is an Integer in Java
Filed under Algorithms
Finding if an integer’s square root is also an integer is an interesting subject. Let’s look at some techniques we can use.
Java File Separator vs File Path Separator
Filed under Java
To make our code portable between operating systems, we need to handle the directory and path separator characters correctly. We look at a few ways that Java can help use the correct characters for the host operating system.
Java Weekly, Issue 367
Filed under Weekly Review
An OpenJDK with JWarmup and coroutines, pattern matching for arrays, JVM performance rabbit hole, distributed metadata management, and a more effective developer experience!
Difference Between JSF, Servlet, and JSP
Filed under Architecture
Explore the purpose of each technology, its lifecycle, and prominent features.
Learn JPA & Hibernate
Filed under Persistence, Series
A series of tutorials on the core features of JPA and Hibernate.
New Features in Java 12
Filed under Java
Explore the new features implemented in Java 12.
Data Modeling with Apache Kafka
Filed under Algorithms, DevOps
Learn how to use a Docker environment to cover the fundamentals of data modeling for a system that uses Apache Kafka for message processing.
Java Weekly, Issue 366
Filed under Weekly Review
Millions of virtual threads, virtual thread pools, GraalVM meets COBOL, Intellij on M1, Telemetry and Protobuf, and Spec updates for Java 16!
Character#isAlphabetic vs. Character#isLetter
Filed under Java
Understand the difference between the isAlphabetic() and isLetter() methods of the Java Character class.
Java Weekly, Issue 365
Filed under Weekly Review
Virtual threads in Helidon, Out of native memory, circuit breakers, testing HTTP clients, container security, and all benchmarks are wrong!
Collections.synchronizedMap vs. ConcurrentHashMap
Filed under Java Collections, Java Concurrency
Learn the differences between Collections.synchronizedMap and ConcurrentHashMap.
Spring Boot: Customize the Jackson ObjectMapper
Filed under Jackson, JSON, Spring Boot
Learn how to configure the serialization and deserialization options for Jackson using Spring Boot.
New Features in Java 14
Filed under Java
Explore various JEPs of Java 14.
Java Weekly, Issue 364
Filed under Weekly Review
The one with performance: HotSpot JVM intrinsics, AppCDS with jLink, gRPC meets Kotlin, Maven’s speed daemon, JDBC’s statement caching, and Apple’s M1!
Scheduled WebSocket Push with Spring Boot
Filed under Spring Boot
In this tutorial, we’ll see how to send scheduled messages from a server to the browser using WebSockets.
Configuring a Project to Exclude Certain Sonar Violations
Filed under DevOps
For some analyses, SonarQube needs some exclusions added to avoid false positives. We investigate a few ways to configure it.
InvalidAlgorithmParameterException: Wrong IV Length
Filed under Security
In this tutorial, we’ll describe how to avoid InvalidAlgorithmParameterException when we generate the IV and use it in a cipher algorithm.
Java Weekly, Issue 363
Filed under Weekly Review
Lots of innovation happening: HTTP/3 in Netty, Reactive Hibernate, Static images for JVM, Maven 4, Docker deprecation on K8S, and also, the value of 1-on-1 sessions!
Comparing Doubles in Java
In this tutorial, we’ll talk about the different ways of comparing double values in Java.
A Guide to MultipleBagFetchException in Hibernate
Filed under Persistence
Learn about the MultipleBagFetchException in detail.
Java Weekly, Issue 362
Filed under Weekly Review
Say hello to Java 16: one small step towards value types and a more efficient Metaspace. Also, buildpacks with layered Jars, and becoming an effective team lead!
Introduction to Servlets and Servlet Containers
Filed under Java
Learn the concepts around servlets, their containers, and a few essential objects they revolve around.
Java AES Encryption and Decryption
Filed under Security
Learn how to implement AES encryption and decryption using the Java Cryptography Architecture.
NoSuchFieldError in Java
Filed under Java
Let’s understand the cause behind NoSuchFieldError and how to resolve it.
Thymeleaf Variables
Filed under Spring Boot
Learn how to define and use variables in Thymeleaf
Security Context Basics: User, Subject and Principal
Filed under Security
A quick overview of basic terms associated with the security context.
Digital Certificate: How to Import .cer File into Truststore File
Filed under Security
Learn about a few tools that we can use to import certificates in .cer format into the client’s truststore
Java Weekly, Issue 361
Filed under Weekly Review
New release of GraalVM, Speculating over the fate of Loom and Valhalla, Building a server framework, Cloud computing and climate change, and in praise of humility!
The Capacity of an ArrayList vs the Size of an Array in Java
Filed under Java Collections
The capacity of an ArrayList functions differently to the size of an Array. We explore the differences and when it’s a good idea to set an ArrayList’s size.
Performance Difference Between save() and saveAll() in Spring Data
Filed under Persistence, Spring Data
A quick and practical performance comparison between save() and saveAll() in Spring Data.
Creating a Generic Array in Java
Filed under Java Collections
The loose types of Java generics are hard to coerce into the strong types of Java arrays. We explore the problem and some common solutions.
Reusing Docker Layers with Spring Boot
In this tutorial, we’ll see how to exploit the new capabilities of Spring Boot to reuse Docker layers.
Java Weekly, Issue 360
Filed under Weekly Review
Meet Spring Boot 2.4, Embracing subatomic Java, Catching up with the new Java features, and a set of practical guides on distributed systems.
Defining Indexes in JPA
Filed under Persistence
Learn how to implement and use indexes using JPA.
Maven Packaging Types
Filed under Maven
In this article, we explore the different packaging types available in Maven.
DispatcherServlet and web.xml in Spring Boot
Filed under Spring Boot, Spring Web
Learn how to migrate code from a web.xml file to DispatcherServlet in a Spring Boot application.
Java Weekly, Issue 359
Filed under Weekly Review
All things Reactive: R2DBC joins Reactive Foundation, Reactive Manifesto II, and The Reactive Principles. NUMA meets G1, GraphQL at scale, and write angry!
JPA CascadeType.REMOVE vs orphanRemoval
Filed under Persistence
Learn about the difference between JPA CascadeType.REMOVE and orphanRemoval for deleting entities.
Ignoring Fields With the JPA @Transient Annotation
Filed under Persistence
Learn how to ignore fields using the JPA @Transient annotation in Java.
Localizing Exception Messages in Java
Filed under Java
Learn how to use the getLocalizedMessage() method to provide localized exception messages
Java IndexOutOfBoundsException “Source Does Not Fit in Dest”
Filed under Java Collections
Learn about the IndexOutOfBoundsException: “Source does not fit in dest” in Java.
Check if a Java Program Is Running in 64-Bit or 32-Bit JVM
Filed under Java
Learn how a Java program can detect whether it’s running in a 64-bit or 32-bit JVM.
Java (String) or .toString()?
Filed under Java
Learn about the differences between String casting and executing the toString() method in Java.
Java Weekly, Issue 358
Filed under Weekly Review
2 million virtual threads with Loom, reactive to coroutines, cloud-native Spring Boot, working effectively with databases and context matters!
The transient Keyword in Java
Filed under Java
Learn about the transient keyword and see its behavior through examples
Understanding the & 0xff Value in Java
Filed under Java
Learn how to use the 0xff value with the bitwise AND operator in Java.
Apache Commons Collections vs Google Guava
Filed under Guava, Java Collections
Explore the functionality offered by Apache Commons and Google Guava, specifically in the area of the collections framework.
Java Weekly, Issue 357
Filed under Weekly Review
Revisiting project Jigsaw and first-level cache in Hibernate, a little competition for SDKMAN!, moving data at petabyte scale, and fallacies about time and timezones!
Retrofit 2 – Dynamic URL
Filed under HTTP Client-Side
Learn how to create a dynamic URL in Retrofit2
Accessing Keycloak Endpoints Using Postman
Learn about the Keycloak REST APIs and how to call them in Postman
Java Weekly, Issue 356
Filed under Weekly Review
Tale of legendary duos: Shenandoah and Java 11, Unix sockets and Java 16, TestContainers and JPA, and finally Distributed Tracing and Netflix!
Getting Database URL From JDBC Connection Object
Filed under Persistence
Learn how to obtain the database URL from a JDBC Connection object.
Java Weekly, Issue 355
Filed under Weekly Review
Project Panama delivers, Dockerizing Java applications, EFK stack for logging, a little about queuing theory, and COBOL ain’t gonna go anytime soon.
Java Weekly, Issue 354
Filed under Weekly Review
Everything revolves around JVM: Talking with the Shenandoah team, JIT and Graal internals, current trends in the Java ecosystem, and learning a new programming language!
How to Stop Execution After a Certain Time in Java
Filed under Java Concurrency
Learn different ways to end a long-running execution after a certain time in Java.
Background Jobs in Spring with JobRunr
Filed under Spring Boot
Look into distributed background job scheduling and processing in Java using JobRunr and have it integrate with Spring.
Checking if a Java Class Is ‘Abstract’ Using Reflection
Filed under Java
Learn how to check whether a Java class is abstract using the Reflection API.
Using libphonenumber to Validate Phone Numbers
Filed under Java
Explore the functionality offered by libphonenumber to format and validate phone numbers using code samples.
Java Weekly, Issue 353
Filed under Weekly Review
Back to the basics: one step closer to inline classes, benchmarking GC latencies, Java after 8, and why it’s not a good idea to rely on averages!
Getting Started with jOOQ
Filed under Persistence
Learn how to configure and create a simple CRUD application using the jOOQ framework.
How To Get Cookies From the Apache HttpClient Response
Filed under HTTP Client-Side
Learn how to retrieve and set cookies from Apache’s HttpClient response
Reading an HTTP Response Body as a String in Java
Filed under HTTP Client-Side, REST, Spring
Explore several options for reading an HTTP response body as a string in Java
@BeforeAll and @AfterAll in Non-Static Methods
Filed under Testing
While unit testing, we may occasionally want to use @BeforeAll and @AfterAll in non-static setup and tear-down methods. Let’s see how we can do it.
How to Set TLS Version in Apache HttpClient
Filed under HTTP Client-Side, Security
Learn how to set the TLS version in Apache HTTPClient
Guide to the Gradle Wrapper
Filed under Gradle
In this tutorial, we’ll learn about Gradle Wrapper, an accompanying utility that makes it easier to distribute projects.
Java Weekly, Issue 352
Filed under Weekly Review
More resilient Java with Bulkheads, a new ML library for Java, GraalVM native images, Spring Boot performance, reinventing VMs, and talent isn’t everything! Oh, and the Baeldung “sale”. Good stuff this week.
Listing the Available Cipher Algorithms
Let’s take a look at how we can list the available cipher algorithms.
CharacterEncodingFilter In SpringBoot
Filed under Spring Boot
Learn about the CharacterEncodingFilter and its usage in a Spring Boot application.
Get the First Key and Value From a HashMap
Filed under Java Collections
In this tutorial, we’ll discuss how to get the first key-value pair from a HashMap without knowing the key.
Checking if a Method Is Static Using Reflection in Java
Filed under Java
Learn how we can check if a method is static or not.
Sending Emails with Attachments in Java
Filed under Java
Learn how to send emails with single and multiple attachments in Java.
How to Remove a Prefix From Strings in Groovy
Filed under Programming
Learn how to remove the prefix from a string using Groovy.
Java Weekly, Issue 351
Filed under Weekly Review
Java 15 goes GA, A collection of Spring/JPA topics, creating highly scalable distributed systems, and good looking GitHub profiles!
Differences in @Valid and @Validated Annotations in Spring
Filed under Spring Web
Explore the key differences between the @Valid and @Validated annotations.
Arrays.asList vs new ArrayList(Arrays.asList())
Filed under Java Collections
They may look very similar but they aren’t. Let’s explore why.
How to Implement Hibernate in an AWS Lambda Function in Java
Filed under Cloud, Persistence
Look at the challenges of using any RDBMS within a Lambda, and how and when Hibernate can be useful
Java Weekly, Issue 350
Filed under Weekly Review
GC enhancements in Java 15, JPA lifecycle events, Docker and Spring Boot, Distributed tracing, and perks of hiring junior engineers: packed in a diverse weekly!
Keycloak User Self-Registration
Filed under Security
Learn how to enable user self-registration in Keycloak.
Rolling Back Migrations with Flyway
Filed under Persistence
Learn how to safely roll back migrations using Flyway.
Dates in OpenAPI Files
Filed under Spring Web
Let’s see how to declare dates in an OpenAPI file, in this case, implemented with Swagger.
IllegalMonitorStateException in Java
Filed under Java Concurrency
If you want to learn why your code keeps throwing this exception, this article is for you.
Custom User Attributes with Keycloak
Filed under Spring
Learn how to add extra attributes to a user in Keycloak.
Java Weekly, Issue 349
Filed under Weekly Review
Faster startup for JVM, mind-boggling Java puzzlers, customizing JPA repositories, Slicing Boot tests, and professional video calls: All in a very diverse weekly!
Hiding Endpoints From Swagger Documentation in Spring Boot
Filed under REST, Spring Boot, Spring Web
Let’s have a look at how we can hide endpoints from Swagger API documentation.
Tips for Creating Efficient Docker Images
Filed under Docker
Learn how to write efficient Docker images and the reasons behind each recommendation
Assert Two Lists for Equality Ignoring Order in Java
Filed under Java Collections, Testing
Learn how to make order agnostic comparison of lists when writing unit tests.
Guide to ArrayStoreException
Filed under Java
Learn the cause of ArrayStoreException, how to handle it, and best practices for avoiding it
Testing Quarkus Applications
Learn how to write clean and powerful unit and integration tests for Quarkus applications.
Largest Power of 2 That Is Less Than the Given Number with Java
Filed under Algorithms
Learn how to find the largest power of 2 that is less than an input number.
Introduction to keytool
Learn how to generate certificates with keytool.
Java Weekly, Issue 348
Filed under Weekly Review
Kotlin 1.4 is out with lots of small yet useful features! Intriguing topics on GraalVM, Spring, Hibernate, and SQL. Also, more patterns to design distributed systems.
Spring MVC Async vs Spring WebFlux
Filed under Reactive, Spring MVC
Learn about Spring Async and Spring WebFlux both theoretically and practically with a basic load test
Using application.yml vs application.properties in Spring Boot
Filed under Spring Boot
Spring Boot supports both .properties and YAML. We explore the differences between injecting properties, and how to provide multiple configurations.
Leadership Election With Consul
Filed under Architecture, DevOps
Let’s see how Leadership Election with Consul helps to ensure data stability.
Java Weekly, Issue 347
Filed under Weekly Review
Efficient docker images for Spring Boot, lots of small upgrades for Spring, more patterns for distributed systems, and a historical take on date and time!
NoSuchMethodError in Java
Filed under Java
Let’s look at the java.lang.NoSuchMethodError and some ways to handle it.
What Is the Hi/Lo Algorithm?
Filed under Persistence
Learn how to the use Hi/Lo algorithm as a database identifier generation strategy.
Introduction to Spring Data Azure Cosmos DB
Filed under Cloud, Spring Data
Learn how to interact with Azure Cosmos DB using Spring Data.
What Is the Difference Between DVM and JVM?
Filed under Java
Learn about the differences between the Java Virtual Machine (JVM) and the Dalvik Virtual Machine (DVM).
List All Classes Loaded in a Specific Class Loader
Filed under Java
List all the classes loaded by a specific class loader in Java
Extracting Database Metadata Using JDBC
Filed under Persistence
Learn how to retrieve database metadata using a JDBC connection and the DatabaseMetaData interface.
Java Weekly, Issue 346
Filed under Weekly Review
A very diverse anthology: Project Amber’s design documents are already on GitHub, cloud functions in Micronaut, patterns for distributed systems, and advice for effective blogging.
How to Disable Spring Security Logout Redirects
Filed under Security, Spring Security
Take a close look at how to disable logout redirects in Spring Security.
Java Files Open Options
Filed under Java
Learn about the several options when opening files in Java.
Introduction to Spring Data JDBC
Filed under Spring Data
A quick and practical guide to Spring Data JDBC.
Set Field Value With Reflection
Filed under Java
Learn how to set values of private fields in Java using the Reflection API.
Difference Between request.getSession() and request.getSession(true)
Filed under Java
Understand the difference between calling HttpServletRequest#getSession() and HttpServletRequest#getSession(boolean).
Apache Maven Guide
Learn how to work with Apache Maven, the popular Java build automation tool
Spring @PathVariable Annotation
Filed under Spring MVC
When we need to extract values from the request URI, @PathVariable is the way to go. Let’s look how to use it.
Determine if an Object Is of Primitive Type
Filed under Java
Learn how to determine if an object is of primitive type using Java.
Java Weekly, Issue 345
Filed under Weekly Review
Microsoft continues to contribute to the Java ecosystem with new the OpenJDK for ARM and JMS over AMQP. Also, Patterns to manage distributed systems and finally, working effectively from home!
Flyway Repair With Spring Boot
Filed under Persistence, Spring Boot
Learn how to recover from a failed Flyway migration using Spring Boot.
XML Defined Beans in Spring Boot
Filed under Spring Boot, XML
Learn about XML defined beans in Spring Boot.
Skipping Tests With Gradle
In this short tutorial, we’ll see how to skip tests when using the Gradle build tool.
How to Implement a CNN with Deeplearning4j
Filed under Algorithms, Java
Learn how to build and train a convolutional neural network model using the Deeplearning4j library in Java.
When Are Static Variables Initialized in Java?
Filed under Java
Learn about the static variable initialization in Java.
Comparing Arrays in Java
Filed under Java
Have a look at different ways to compare arrays in Java.
Taking Screenshots Using Java
Filed under Java
Learn how to take screenshots using Java.
Preserving Line Breaks When Using Jsoup
Filed under XML
Learn different ways of preserving line breaks in HTML using Jsoup.
System.console() vs. System.out
Filed under Java
Learn about the differences between System.console() and System.out.
Setting Formulas in Excel with Apache POI
Learn how to set and evaluate Excel formulas in Java with Apache POI
Using Mockito ArgumentCaptor
In this tutorial, we’ll cover a common use case of using Mockito ArgumentCaptor in our unit tests.
Guide to SDKMAN!
Learn how to manage several versions of Java SDKs among other Java Ecosystem tools using SDKMAN!
Java Weekly, Issue 344
Filed under Weekly Review
Java is moving so fast! Java 15 is about to be released and we have two exciting news about Java 16. Also, some interesting topics on Security and Cloud.
Liskov Substitution Principle in Java
Filed under Java, Programming
The L in SOLID, the Liskov Substitution Principle helps structure object oriented design. We also explore how it supports the Open/Closed Principle.
Converting List to Map With a Custom Supplier
Filed under Java Collections
Learn several ways to convert a List into a Map using Custom Suppliers.
Java Weekly, Issue 343
Filed under Weekly Review
Another step for Project Loom in Java 15 and Deprecating Biased Locking, Cool topics on Cloud, Microservices, and Istio. And finally some OS classics!
Difference Between Statement and PreparedStatement
Filed under Java, Persistence
Explore the differences between JDBC’s Statement and PreparedStatement interfaces.
Java Weekly, Issue 342
Filed under Weekly Review
Lots of interesting topics in a wide range of topics: JVM internals, JUnit 5 tricks, Spring Profiles, Ktor, Infrastructure Costs, and a lot more.
Finding Top K Elements in a Java Array
Filed under Algorithms
implement different solutions to the problem of finding the k largest elements in an array with Java
Reading the Value of ‘private’ Fields from a Different Class in Java
Filed under Java
Learn how to access the private fields of another class and read their values using the Java Reflection API.
Convert an Array of Primitives to a List
Filed under Java
Learn how to convert an array of primitives to a List of objects of the corresponding type.
Loading JDBC Drivers
Filed under Java, Persistence
Learn some of the basic steps needed to load JDBC drivers
YAML to List of Objects in Spring Boot
Filed under Spring Boot
Learn how to map a YAML list into a java List using Spring Boot.
Adding Text to an Image in Java
Filed under Java
Learn how to add text to images in Java
Converting a Java String Into a Boolean
Filed under Java
Learn how to convert a string into a boolean using Java.
How to Resolve a Version Collision of Artifacts in Maven
Filed under Maven
Multi module maven projects can experience difficulties at compile time and runtime with multiple library versions. We learn how to control the versions used.
How Can I Resize an Image Using Java?
Learn how to resize (scale) an image using Java.
Division by Zero in Java: Exception, Infinity, or Not a Number
Filed under Java
When dividing by zero, integer division always throws an Exception. This is not the case with floating-point numbers, however. Let’s see why.
Java Weekly, Issue 341
Filed under Weekly Review
Lots of interesting writeups on a wide variety of topics: From new Spring improvement and Oracle Coherence to SOLID principles and freelancing.
How to Count the Number of Matches for a Regex?
Filed under Java
Regular expressions can help us with text processing. Here we explore how to count the number of matches of a regular expression in some text.
Print an Integer in Binary Format in Java
Filed under Java
Explore different ways of printing an integer in binary format in Java.
Mapping Collections with MapStruct
Filed under Java
Explore how to map collections using MapStruct.
Java Weekly, Issue 340
Filed under Weekly Review
The Spring ecosystem is moving forward, with several major milestones. The Java language itself is also revisiting some core concepts as well. An interesting week.
Simple Single Sign-On with Spring Security OAuth2 (legacy stack)
Filed under Spring Security
A simple SSO implementation using Spring Security OAuth2 and Boot.
Inject a Map from a YAML File with Spring
Filed under Spring
Learn how to inject a Map from a YAML file in Spring Boot.
Getting MAC Addresses in Java
Learn how to get the mac addresses of network card interfaces in Java.
Finding Unused Gradle Dependencies
Filed under Gradle
Learn how to use the Gradle Nebula Lint plugin to identify and fix unused dependencies in your project
How to Share DTO Across Microservices
Filed under Architecture
Learn ways in which DTOs are shared between microservices
Testing a Spring Multipart POST Request
Filed under Spring Web
Learn how to test a Spring Multipart POST Request using MockMvc with the help of an example.
The Covariant Return Type in Java
Filed under Java
Explore what the covariance and covariant return types are and how they behave in Java.
Java Heap Space Memory with the Runtime API
Filed under Java
Learn how to access memory information of a JVM using the Java Runtime API.
Easy Ways to Write a Java InputStream to an OutputStream
Filed under Java
Learn how to write a Java InputStream to a Java OutputStream.
Java Weekly, Issue 339
Filed under Weekly Review
The Spring story on GraalVM is getting polish and Java 14 and even 15 features are getting some well-deserved attention. A solid week in the Java ecosystem.
Number Formatting in Java
Filed under Java
Learn to format numbers in Java.
Converting a Spring MultipartFile to a File
Filed under Spring Web
Learn to convert a Spring MultipartFile to a File.
Groovy Variable Scope
Filed under Programming
Learn about variable scope in Groovy
WildFly Administration Remote Access
Filed under Programming
Learn how to expose the administrator console of WildFly for remote access.
Conditional CSS Classes in Thymeleaf
Filed under Spring MVC
Learn a few different ways to conditionally add CSS classes in Thymeleaf.
Testing Exceptions with Spring MockMvc
Filed under Spring MVC, Testing
Learn how to unit test controller exceptions using Spring MockMvc.
Redirecting Logged-in Users with Spring Security
Filed under Spring Security
Learn several ways how to redirect logged-in users from the login page using Spring Security.
Spring @RequestParam vs @PathVariable Annotations
Filed under Spring
Understand the differences between Spring’s @RequestParam and @PathVariable annotations.
Java Weekly, Issue 338
Filed under Weekly Review
This week is Spring-heavy, which is always cool 🙂 and, on top of that, a really solid writeup about building resilience. Good stuff.
Java IOException “Too many open files”
Filed under Java
Learn when and how to avoid the “Too many open files” exception in Java.
The Difference between RxJava API and the Java 9 Flow API
Filed under Reactive
Learn about the Reactive Stream Specification and see a practical example of Flow API and RxJava implementations for a live video stream
Test a Mock JNDI Datasource with Spring
Filed under Spring Persistence, Testing
Learn how to test a mock JNDI datasource using the Spring Framework and the Simple-JNDI library.
Testing @Cacheable on Spring Data Repositories
Filed under Spring Data, Spring Persistence
Learn how to isolate the caching layer in your Spring Data tests.
Writing IntelliJ IDEA Plugins Using Gradle
Learn how to write your own IntelliJ plugin using Gradle.
Spring YAML vs Properties
Filed under Spring
Compare the usage of Spring YAML versus the properties file.
When Does JPA Set the Primary Key
Filed under Persistence
Learn about the different strategies JPA uses to generate the primary key for an entity and at which moment each strategy sets the key value during persistence.
Circular View Path Error
Filed under Spring Web
Learn about the Circular View Path error in a Spring Boot project.
Java Weekly, Issue 337
Filed under Weekly Review
Distributed caching, Kafka, and Spring Boot – the ecosystem is moving forward.
What Is [Ljava.lang.Object;?
Filed under Java
Learn what [Ljava.lang.Object; is and how to better print array objects.
The “Cannot find symbol” Compilation Error
Filed under Java
Review what compilation errors are, and then specifically explain what the “cannot find symbol” error is and how it’s caused.
Using Kafka MockProducer
Learn how to use Kafka’s MockProducer to verify common producer operations
Hibernate could not initialize proxy – no Session
Filed under Persistence
Learn how to handle org.hibernate.LazyInitializationException : could not initialize proxy – no Session in Java
Proxies With RestTemplate
Filed under HTTP Client-Side, REST
Learn how to send a request to a proxy using Apache’s RestTemplate in Java.
Java Weekly, Issue 336
Filed under Weekly Review
A nice intro to Amazon’s Deep Java Library for machine learning, and Spring Tools 4.6.2 is released.
Quick Guide to Spring Cloud Open Service Broker
Filed under Spring Cloud
Learn how to implement the Open Service Broker API using Spring Cloud Open Service Broker.
What Causes java.lang.OutOfMemoryError: unable to create new native thread
Filed under Java Concurrency
Learn about what causes the java.lang.OutOfMemoryError: unable to create new native thread error.
Partial Data Update With Spring Data
Filed under Spring Data
Learn techniques and approaches to performing a partial instead of a full update
Multi-Release JAR Files with Maven
Filed under Maven
Learn about Maven’s support for multi-release JAR files
Converting a BufferedReader to a JSONObject
Filed under JSON
Learn about JSONObject’s support for Readers
Casting int to Enum in Java
Filed under Java
Learn how to cast an int to an Enum in Java
Java Weekly, Issue 335
Filed under Weekly Review
An in-depth review of Apache Arrow’s in-memory data format for fast, machine-to-machine transfer of big data, and a migration guide for Spring Data JDBC 2.0.
Setting Custom Feign Client Timeouts
Filed under Spring Cloud
Learn how to set custom timeouts on the Spring Cloud’s Feign Client.
Using Kafka MockConsumer
Explore the MockConsumer, one of Kafka’s Consumer implementations
LinkedBlockingQueue vs ConcurrentLinkedQueue
Filed under Java Collections, Java Concurrency
Learn the difference between LinkedBlockingQueue and ConcurrentLinkedQueue in Java
Clicking Elements in Selenium using JavaScript
Learn how to click elements using Javascript in Selenium.
Open/Closed Principle in Java
Filed under Java
Explore the Open/Closed Principle (OCP) as one of the SOLID principles of object-oriented programming in Java.
Java Weekly, Issue 334
Filed under Weekly Review
A guide to switch expressions in Java 14, and a great article explains how developers can overcome their aversion to refactoring through deliberate practice.
Formatting Currencies in Spring Using Thymeleaf
Filed under Spring Web
Learn to format currencies in Spring using Thymeleaf.
Java Weekly, Issue 333
Filed under Weekly Review
A preview of Spring Boot support for GraalVM Native Images, and Spring Security and Boot release several new versions.
Introduction to Finagle
Filed under Java
Learn how to send and receive information over the wire using Twitter’s RPC Library Finagle.
Transactional Annotations: Spring vs. JTA
Filed under Persistence, Spring
A quick and practical comparison of various @Transactional annotations.
Log4j 2 Plugins
Filed under Logging
Learn how to use the Log4j 2 extension mechanism to implement custom plugins
Foreign Memory Access API in Java 14
Filed under Java
Java 14 brings in a new API to wrap accessing memory managed outside of the JVM. Here we explore the need for the API and how it works.
Validate Phone Numbers With Java Regex
Filed under Java
Learn how to validate different formats of phone numbers using regular expressions.
Logout in an OAuth Secured Application (using the Spring Security OAuth legacy stack)
Filed under Spring Security
A practical deep-dive into how to implement logout in a Spring Security OAuth2 application with JWT, using Spring Security OAuth legacy stack.
How to Dynamically Autowire a Bean in Spring
Filed under Spring
Learn how to autowire beans dynamically given ceertain conditions.
Spring Cloud Gateway WebFilter Factories
Filed under Spring Cloud
Learn about Spring Cloud Gateway’s built-in WebFilter factories and how to use them in advanced scenarios
Spring Data Redis’s Property-Based Configuration
Filed under NoSQL, Spring Data
Learn how to configure Spring Boot to talk to Redis via Lettuce
How to Set Environment Variables in Jenkins?
Filed under DevOps
Learn about the different ways to set and use environment variables in Jenkins.
Find Unused Maven Dependencies
Filed under Maven
Learn how to analyze unused dependencies in Maven using the Maven Dependency Plugin.
Manual Logout With Spring Security
Filed under Spring Security
Learn how to execute a manual logout with Spring Security.
Generate Database Schema with Spring Data JPA
Filed under Spring Data, Spring Persistence
JPA provides a standard for generating DDL from our entity model. Here we explore how to do this in Spring Data and compare that with native Hibernate.
Spring JPA @Embedded and @EmbeddedId
Filed under Spring Data, Spring Persistence
Learn how to use the @EmbeddeId and @Embeddable annotations to represent composite keys in JPA entities.
How to Add Proxy Support to Jsoup?
Filed under Data
Learn how to add proxy support to Jsoup
Asserting Log Messages With JUnit
Filed under Testing
Learn how to test log messages with JUnit
Building a Java Application With Gradle
Filed under Gradle, Programming
A quick and practical guide to building Java applications in Gradle.
Java Weekly, Issue 332
Filed under Weekly Review
Spring adopts new versioning schemes, and an in-depth look at Java’s new text blocks feature.
Single Responsibility Principle in Java
Filed under Programming
A quick and practical guide to the Single Responsibility Principle in Java
Disable Security for a Profile in Spring Boot
Filed under Spring Security
A quick and practical guide to disabling Spring Security for a specific profile in Spring Boot.
Mapping Lists with ModelMapper
Filed under Data, Java Collections
Learn how to map lists of different element types using Model Mapper.
Java Weekly, Issue 331
Filed under Weekly Review
A handful of Spring configuration tips for getting the most out of application.properties files, and Spring Tools 4.6.1 is released.
Using Multiple Cache Managers in Spring
Filed under Spring
Learn how we can enable multiple cache managers in our Spring Boot application.
Constructing a JPA Query Between Unrelated Entities
Filed under Java, Persistence
Learn to construct a JPA query between unrelated entities.
Spring Security Custom Logout Handler
Filed under Spring Security
Learn how to implement a Custom Logout Handler using Spring Security.
An Introduction to Kaniko
Filed under DevOps
Learn how to build container images using Kaniko.
Building a Simple Web Application with Spring Boot and Groovy
Filed under Spring Boot
Learn how to build a simple todo application with Spring Boot and Groovy.
Encode a String to UTF-8 in Java
Filed under Java
Learn how to encode a Java String to the UTF-8 character set.
Mocking the ObjectMapper readValue() Method
Learn how to mock the Jackson ObjectMapper’s readValue method with Mockito.
The Difference Between mockito-core and mockito-all
Explore the difference between mockito-core and mockito-all.
How to Determine the Data Type in Groovy
Filed under Programming
Explore different ways to find the data type in Groovy.
Java Weekly, Issue 330
Filed under Weekly Review
A quick look at building native images for Spring Boot apps with GraalVM, and a new series from Martin Fowler on source code branching patterns.
Oracle Connection Pooling With Spring
Filed under Spring Data
Learn how to setup connection pooling to an Oracle database with Spring Data
OAuth2 for a Spring REST API – Handle the Refresh Token in AngularJS (legacy OAuth stack)
Filed under Spring Security
We learned how to store the Refresh Token in an AngularJS client app, how to refresh an expired Access Token and how to leverage the Zuul proxy.
Hibernate Error “No Persistence Provider for EntityManager”
Filed under Persistence
A quick explanation and solution for the “No Persistence Provider for EntityManager” error.
Recommended Package Structure of a Spring Boot Project
Filed under Spring Boot
A quick and practical overview of a recommended package structure for Spring Boot projects.
The Map.computeIfAbsent() Method
Filed under Java
Learn the intricacies of the Map.computeIfAbsent method.
Handling java.net.ConnectException
Filed under Java
Learn how to handle java.net.ConnectException
How to Test GraphQL Using Postman
Filed under Testing, Web Services
Learn about Postman’s support for GraphQL
Introduction to DBUnit
Learn how to set up database states for your unit tests using DBunit.
Writing Templates for Test Cases Using JUnit 5
Filed under Testing
Learn how to create a test template using JUnit 5.
How to Extract a Mono’s Content in Java
Learn how to subscribe or block for a Mono’s promised value.
Convert String to Integer in Groovy
Filed under Programming
Learn the several ways to convert from a String to an Integer in Groovy
Introduction to Mockito’s AdditionalAnswers
Filed under Java
A quick and practical guide to Mockito’s AdditionalAnswers.
Java Map With Case-Insensitive Keys
Filed under Java Collections
Learn about different Map implementations that accept all case variations of a String as the same key
Java Weekly, Issue 329
Filed under Weekly Review
A good intro to the new Kotlin DSL for Spring Integration, and a quick look at Java 14’s pattern-matching enhancement for the instanceof operator.
Spring Configuration Bootstrap vs Application Properties
Filed under Spring Boot, Spring Cloud
A quick overview of context hierarchies in Spring Cloud.
Spring MVC Data and Thymeleaf
Filed under Spring MVC
Learn the several ways that Spring MVC and Thymeleaf can work together to render data.
Guide to the Number Class in Java
Filed under Java
Learn what the Java Number class does and what methods it contains.
Java Weekly, Issue 328
Filed under Weekly Review
An overview of RSocket channels for bi-directional data streaming, and a deep dive into authentication and authorization in Spring Security.
Using Guava’s MapMaker
Filed under Guava
Learn how to use Guava’s MapMaker class to create maps with weak references.
Conditional Flow in Spring Batch
Filed under Spring
Learn how to create Spring Batch jobs with conditional flow.
Introduction to Guava Throwables
Filed under Guava
A quick and practical introduction to Guava Throwables.
Helpful NullPointerExceptions in Java 14
Filed under Java
Learn about helpful NullPointerExceptions in Java 14.
Intro to Coroutines with Quasar
Filed under Java Concurrency
Learn to implement coroutines in Java using Quasar.
Add BigDecimals using the Stream API
Filed under Java
While the streams API provides a useful way to calculate the sum of some numeric types, BigDecimal is not support. Here we learn how to calculate sums with reduce.
Returning Plain HTML From a Spring MVC Controller
Filed under Spring MVC
Learn how to return HTML from a Spring MVC controller.
Difference Between BeanFactory and ApplicationContext
Filed under Spring
Learn about the significant differences between Spring’s ApplicationContext and BeanFactory with practical examples
How to Determine Day of Week by Passing Specific Date in Java?
Filed under Java
A quick and practical guide to determining the day of the week in Java.
Java Weekly, Issue 327
Filed under Weekly Review
A preview of Kubernetes support coming to Spring Boot 2.3, and a handful of Google Cloud tools to help you build and deploy Spring Boot microservices.
The Clear-Site-Data Header in Spring Security
Filed under Spring Security
Learn how to use Spring Security’s with ClearSiteDataHeaderWriter to add the HTTP Clear-Site-Data response header
Fixing “constant string too long” Build Error
Filed under Java
Learn to fix the “constant string too long” build error in Java.
Prevent ApplicationRunner or CommandLineRunner Beans From Executing During Junit Testing
Learn how to prevent ApplicationRunner or CommandLineRunner beans from executing during JUnit tests.
Gradient Descent in Java
Filed under Algorithms, Data
Learn about Gradient Descent in Java and why backtracking is so important.
Java Weekly, Issue 326
Filed under Weekly Review
An overview of the RSocket request-stream messaging model, and a quick guide to writing a controller for Kubernetes clusters in Java using the Fabric8 API.
Introduction to Lock Striping
Filed under Java Concurrency
Learn the key differences between coarse-grained synchronization and fine-grained synchronization and how to implement them in Java.
Exploring a Docker Container’s Filesystem
Filed under Docker
Learn various ways to explore the filesystem of a Docker container
Spring REST API + OAuth2 + Angular (using the Spring Security OAuth legacy stack)
Filed under Spring Security
Learn how to set up OAuth2 for a Spring REST API and how to consume that from an Angular client.
Keycloak Embedded in a Spring Boot Application
Filed under Security, Spring Boot
Learn how to set up a pre-configured embedded Keycloak server that can be booted up within a Spring Boot application.
L-Trim and R-Trim Alternatives in Java
Filed under Java
Learn several methods how to achieve l-trim and r-trim in java.
IntelliJ – Cannot Resolve Spring Boot Configuration Properties Error
IntelliJ can provide autocomplete and context help for custom properties, but we need to make some additional configuration to our project to enable that.
Compare Two JSON Objects with Gson
Filed under JSON
Comparison of JSON in its string representation is often less effective than comparing it semantically. Here we use Gson to load the JSON and compare the data.
Java Weekly, Issue 325
Filed under Weekly Review
A handful of tips for getting the most out of Java 14 with Spring, and a good overview of the RSocket protocol’s fire-and-forget messaging.
Guide to the Java Authentication And Authorization Service (JAAS)
Learn about the JAAS security framework that augments the security model from code-based security to user-based security
Using NullAway to Avoid NullPointerExceptions
Filed under Java
Learn how to avoid NullPointerExceptions using NullAway.
Getting Into a Docker Container’s Shell
Filed under Docker
Learn how to connect to a shell of a running Docker container and how to start containers interactively
Java Weekly, Issue 324
Filed under Weekly Review
A simple RSocket client built using Spring Shell and Spring Boot, and a deep dive into writing command-line tools in Java using GraalVM and the Picocli library.
Could Not Reserve Enough Space for Object Heap
Filed under Java
Learn the possible causes for the “Could Not Reserve Enough Space For Object Heap” error and how to solve it.
Injecting a Value in a Static Field in Spring
Filed under Spring
Learn how to inject a value into a static field in Java
Introduction to Apache Beam
Filed under Data
Get started with Apache Beam and this simple word counter
Finding the Spring Version
Learn how to obtain the JDK, Java and Spring versions
Capturing a Java Thread Dump
Filed under Java Concurrency
Learn how to capture a Java thread dump
Testing Spring Boot @ConfigurationProperties
Filed under Spring Boot, Testing
Learn how to test configuration classes in Spring Boot that rely on the @ConfigurationProperties annotation.
Java Weekly, Issue 323
Filed under Weekly Review
An intro to the RSocket messaging protocol for microservices, and a good write-up on the Kotlin-based Ktor framework for client and server development.
DDD Bounded Contexts and Java Modules
Filed under Architecture, Java
Learn how to leverage Java 9 Modules while defining explicit boundaries for bounded contexts while creating a simple store application
Connect Java to a MySQL Database
Filed under Java, Persistence, Spring Persistence
Learn several techniques to connect to a MySQL database from Java.
ThreadPoolTaskExecutor corePoolSize vs. maxPoolSize
Filed under Java Concurrency
Learn about the corePoolSize and maxPoolSize properties in the ThreadPoolTaskExecutor.
Converting Gradle Build File to Maven POM
Learn to convert a Gradle build file to a Maven pom.xml.
Exponential Backoff With Spring AMQP
Filed under Spring
Explore two different ways of implementing a message sending retry strategy named Exponential Backoff.
Java Weekly, Issue 322
Filed under Weekly Review
A solid overview of the Quarkus container-first framework for Java, and Spring Core Framework has a couple of new releases.
How to Lock a File in Java
Filed under Java
Learn about different file locking techniques using the Java NIO Library.
Swagger @ApiParam vs @ApiModelProperty
Learn the difference between Swagger’s @ApiParam and @ApiModelProperty
Using JSON Patch in Spring REST APIs
Filed under JSON, Spring MVC
Learn how to use the HTTP PATCH method along with the JSON Patch document format to apply partial updates to RESTful resources
Modifying the Response Body in a Zuul Filter
Filed under Cloud, Spring Cloud
Learn about the Netflix Zuul’s post filter.
Difference Between Docker Images and Containers
Filed under Docker
Learn about Docker images and containers.
Java Weekly, Issue 321
Filed under Weekly Review
Spring’s new website sports a fresh, clean design, and an exercise in optimizing a Java method with an eye toward minimizing its bytecode footprint.
How to Handle Java SocketException
Filed under Java
Learn what causes SocketException in Java and how to handle it.
Cache Headers in Spring MVC
Filed under Spring MVC
Learn about HTTP caching by using the Cache-Control response header in Spring MVC.
Spring Projects Version Naming Scheme
Filed under Spring Boot
Learn about the naming schemas in Spring.
Java Weekly, Issue 320
Filed under Weekly Review
A deeper dive into the Java records preview feature, and the first JDK 14 Release Candidate is announced.
Intro to OpenCV with Java
Filed under Java
Learn how leverage OpenCV with Java
Guide to AVL Trees in Java
Filed under Algorithms, Java
Learn about AVL Trees and algorithms for inserting, deleting, and searching for values
Case-Insensitive String Matching in Java
Filed under Java
Learn how to perform case-insensitive String matching in Java.
Implement Health Checks in OpenShift
Filed under DevOps
Learn what it means to have a healthy application and how to do it in OpenShift.
Java Weekly, Issue 319
Filed under Weekly Review
A couple of write-ups on the Java Records preview feature in Java 14, and a great introductory guide to Spring Framework.
Difference Between Java Matcher find() and matches()
Filed under Java
Learn about the differences between the find() and matches() methods of the Matcher class.
Java Weekly, Issue 318
Filed under Weekly Review
A sneak peek at improved Docker support coming to Spring Boot, and a collection of cool plugins for IntelliJ IDEA.
Final vs Effectively Final in Java
Filed under Java
Learn the difference between Final and Effectively Final in Java.
java.net.UnknownHostException: Invalid Hostname for Server
Filed under Java
Learn what causes UnknownHostException, how to prevent it, and how to handle it.
Guide to the Cactoos Library
Filed under Java
Explore the Cactoos library and some of the classes it provides for string and data structure manipulation.
Parsing Command-Line Parameters with Airline
Filed under Java
Learn how to parse command-line parameters with Airline
Guide to @CurrentSecurityContext in Spring Security
Filed under Spring Security
Reading from the Spring Security Context can require a bit of boilerplate code. With the @CurrentSecurityContext annotation we can inject the values we need.
Working with Lazy Element Collections in JPA
Filed under Java, Persistence
Learn how to work with lazy collection in JPA.
Guide to Work Stealing in Java
Filed under Java Concurrency
Learn about work stealing in Java.
Balanced Brackets Algorithm in Java
Filed under Algorithms, Java
Learn how to address the problem of Balanced Brackets, also known as Balanced Parentheses, with Java.
List All Available Redis Keys
Filed under Java, Persistence
Learn how to list all of the available Redis keys
Introduction to Jsoniter
Learn how to parse JSON with Jsoniter (json-iterator)
Java Weekly, Issue 317
Filed under Weekly Review
An intro to the Reactive programming support in several high-profile Spring projects, and several new releases are out for Spring Boot and Core.
What Causes java.lang.reflect.InvocationTargetException?
Filed under Java
Learn what Causes java.lang.reflect.InvocationTargetException.
Java Weekly, Issue 316
Filed under Weekly Review
A deep dive into coroutines in Kotlin, and a guide to the RFC-7807 standard for communicating API problems to client applications.
Introduction to Big Queue
Filed under Java
Learn about the Big Queue, a Java implementation of a persistent queue.
Java Preview Features
Filed under Java
A quick and practical overview of Java preview features.
Generating Random Numbers in Java
Filed under Java
Learn different ways of generating random numbers in Java.
Partitioning and Sorting Arrays with Many Repeated Entries with Java Examples
Filed under Algorithms, Java
Learn different ways to partition and sort an array containing many repeated entries.
Looking for Java Developer to Help with Brainstorming Topics for the Site (not open)
Filed under Java
Hiring a Java Dev with Spring Security experience to join the Baeldung team.
Obtaining a Power Set of a Set in Java
Filed under Algorithms, Java Collections
Study the process of generating a power set of a given set in Java.
Java Weekly, Issue 315
Filed under Weekly Review
An overview of installing and managing multiple Java SDKs with SDKMAN!, and a collection of patterns for building an observability pipeline for microservices.
Introduction to Greedy Algorithms with Java
Filed under Algorithms
Learn about greedy algorithms in the Java ecosystem.
Read Excel Cell Value Rather Than Formula With Apache POI
Filed under Data
Learn about different ways to read Excel cell values rather than the formula using Apache POI
Java Do-While Loop
Filed under Java
A quick and practical guide to Java while loops
Java While Loop
Filed under Java
A quick and practical guide to Java while loops
Java For Loop
Filed under Java
A quick and practical guide to Java for loops
Using Cookies With Selenium WebDriver in Java
Filed under Testing
Learn how to use cookies with Selenium WebDriver in Java
Convert Double to Long in Java
Filed under Java
Explore various methods to convert from double to long in Java
Apache RocketMQ with Spring Boot
Filed under Data, Spring Boot
Learn how to use Apache RocketMQ with Spring Boot.
Specify an Array of Strings as Body Parameters in Swagger
Filed under Spring
Learn how to produce a default example value for String arrays as this behavior is not enabled by default.
How to Return Multiple Values From a Java Method
Filed under Java
Some programming languages provide easy ways to return multiple values from a method. In Java, there are a few similar options, depending on the types.
Guide to the Java finally Keyword
Filed under Java
Java’s finally keyword is helpful for clean-up operations around code that may throw errors. We explore how it works and when it can have unexpected behaviour.
Java Weekly, Issue 314
Filed under Weekly Review
A new year for the Java Weekly begins with a solid write-up on detecting JVM memory leaks and a hard look at the JShell REPL for Java.
Arrays.sort vs Arrays.parallelSort
Filed under Java Collections
Learn how Java sort() and parallelSort() differ.
Spring Security and OpenID Connect (Legacy)
Filed under Spring Security
Learn how to set up OpenID Connect (from Google) with a simple Spring Security application.
Java Weekly, Issue 313
Filed under Weekly Review
A complete list of features selected for the Java 14 release, and a great write-up on automatic conflict resolution for concurrent applications.
Bitwise & vs Logical && Operators
Filed under Java
Learn the difference between & and && in Java
Using the Not Operator in If Conditions in Java
Filed under Java
Inverting logical expressions can make your code clearer, and is an important part of using Java. Here are some tricks to master and pitfalls to avoid.
How to Set the JVM Time Zone
Filed under Java
Learn about several ways we can modify the time zone of the JVM using Java.
Quick Guide to the Java Stack
Filed under Java, Java Collections
A quick and practical guide to common operations of the java.util.Stack.
Get Substring from String in Java
Filed under Java
The practical ways of using the useful substring functionality in Java – from simple examples to more advanced scenarios.
Guide to WebRTC
Filed under HTTP Client-Side
Learn how to build a direct, real-time communication channel between two browsers, mobile apps, or other HTML clients using WebRTC.
A Quick Guide to Post Requests with OkHttp
Filed under HTTP Client-Side, Java
Learn about the different features OkHttp has for POST requests.
Guide to the AuthenticationManagerResolver in Spring Security
Filed under Spring Security
Learn how to use Spring Security’s AuthenticationManagerResolver for Basic and OAuth2 authentication flows
Wrapping vs Rethrowing Exceptions in Java
Filed under Java
Explore the main difference between re-throwing the original exception vs first wrapping it.
An Introduction to Podman
Filed under Docker
Learn the basis to interact with Podman – an open-source container management tool for developing, managing and running OCI containers.
Java Weekly, Issue 312
Filed under Weekly Review
An intro to Resilience4j, inspired by Hystrix, and a good presentation on surviving Spring Cloud’s migration away from the Netflix stack.
Maximum Subarray Problem in Java
Filed under Algorithms
Discover two approaches for solving the maximum subarray problem using Java.
Java Weekly, Issue 311
Filed under Weekly Review
The future of Java, a look at the Spring Framework maintenance roadmap for 2020, and a great article on CPU cache performance.
Error Handling with Spring AMQP
Filed under Spring
Learn about different ways of handling errors using Spring AMQP with RabbitMQ.
Overview of Combinatorial Problems in Java
Filed under Algorithms
Learn algorithms for solving a few common combinatorial problems and how to implement them in Java.
Check if Two Strings Are Anagrams in Java
Filed under Java
We may wish to detect whether Strings contain anagrams of each other. Here we explore a few algorithms, with different programming and execution complexity.
Prim’s Algorithm with a Java Implementation
Filed under Algorithms, Java
Learn how Prim’s algorithm works and how to implement it in Java.
Java Weekly, Issue 310
Filed under Weekly Review
Keeping the data you expose separate from the data you store, new GCs in Java and my new OAuth2 course.
Fibonacci Series in Java
Filed under Algorithms
Learn how to generate terms of the Fibonacci series in Java
Introduction to Netflix Genie
Filed under DevOps
Gain an insight into Netflix Genie
How to Implement a Quarkus Extension
Filed under Programming
Learn how to implement a Quarkus extension
Handling URL Encoded Form Data in Spring REST
Learn how to handle URL encoded form data in Spring REST
Circular Linked List Java Implementation
Filed under Java
Learn how to implement a circular linked list in Java.
Spring MVC Themes
Filed under Spring MVC
Learn how to apply and manage themes with Spring MVC