Best of Java — June 2024
- 1
- 2
Community Picks·2y
10 Spring Boot Performance Best Practices
Spring Boot, a popular framework in the Java ecosystem, simplifies application development but sometimes needs optimization for performance. Key practices to enhance performance include using the latest versions of Spring Boot and JVM, enabling virtual threads, leveraging Spring AOT with GraalVM Native Image for faster startup times and reduced memory usage, and employing JVM features like Checkpoint Restore and Class Data Sharing. Configuring threads efficiently for both MVC and database access layers, using effective caching strategies, adopting resiliency patterns like circuit breakers, and incorporating thorough monitoring and profiling are also critical. Tools like Digma can further help by providing performance insights during development.
- 3
- 4
Community Picks·2y
What's Your Go-To Java Framework
Choosing the right Java framework is crucial for project success. This post discusses preferred frameworks like Quarkus and Spring Boot, highlighting the advantages of using Java 21 with features like virtual threads. It also explores tools like Maven and PostgreSQL, emphasizing their benefits for developers. Observability tools like Digma and OpenTelemetry for Quarkus are also covered, demonstrating their importance in monitoring and improving application performance.
- 5
- 6
- 7
Awesome Java Newsletter·2y
Why are my JAVA virtual threads slower than the platform threads?
Exploring the performance differences between Java virtual threads and platform threads, the post highlights how virtual threads can enhance service performance by avoiding idle time during I/O operations. It covers enabling virtual threads in Spring Boot, building a test API for comparison, and performance comparisons using Apache HTTP server benchmarking. The author identifies pinning as the reason for unexpected slowdowns and concludes with strategies for overcoming limitations using MySQL Connector/J.
- 8
Baeldung·2y
HTTP Request and Response Logging Using Logbook in Spring
Logbook is an extensible Java library that enables complete request and response logging for various technologies. By adding a Logbook Maven dependency and configuring logback-spring.xml and application.properties files, HTTP requests and responses can be logged in a Spring Boot application. The library supports filtering and formatting logs, and provides different sinks like the ChunkingSink and LogstashLogbackSink for advanced logging needs. Custom sink implementations and JSON formatting are also possible.
- 9
Foojay.io·2y
Java: Functional Programming f(x) – Part2
This post discusses the important features of functional programming in Java, including lambda expressions, method references, functional interfaces, and the streams API. It highlights the significance of lambda expressions in simplifying code and provides examples of their usage.
- 10
- 11
Baeldung·2y
The Difference Between JUnit and Mockito
This post explores the differences between JUnit and Mockito, two popular testing frameworks in the Java ecosystem. JUnit is focused on creating the testing structure and environment, while Mockito complements JUnit by helping test individual components through mocking and controlling their behavior.
- 12
Reflectoring·2y
Getting started with Spring Security and JWT
Spring Security offers robust security features for Java applications, including session management, authentication, and protection against common threats like CSRF. This guide covers the implementation of JWT (JSON Web Token) for secure communication between two parties. JWTs are versatile and can be used for single sign-on, API authentication, stateless sessions, and microservices. It covers the creation, structure, common use cases, and potential drawbacks of JWTs, as well as a step-by-step guide to implement JWT for authentication in a Spring Boot application.
- 13
- 14
Baeldung·2y
Java Weekly, Issue 548
The issue covers topics including getting started with Jakarta Data and Hibernate, simplifying Java with module import declarations in JDK 23, and mapping Java Enum to custom values with JPA and Hibernate. Also features guides on securing Jakarta EE applications with OIDC and Keycloak, and insights into Kubernetes debugging. Various Spring and Java updates are highlighted alongside technical musings and thought-provoking reads.
- 15
- 16
- 17
Vaadin·2y
Building AI-Powered Java Applications
Java developers are keen on integrating AI into their applications but often find it challenging due to time constraints and the steep learning curve. Enterprise applications benefit greatly from AI, as it can automate complex workflows. To help developers, the author created two application starters: a RAG-based business context-aware chatbot and a sentiment analysis tool for customer feedback, both built with Flow, LangChain4j, and Spring Boot. Ideas for further AI applications are welcomed.
- 18
Grafana Labs·2y
Java observability with OpenTelemetry, Grafana Cloud, and Digma.ai
Modern observability tools like OpenTelemetry and platforms such as Grafana Cloud are making it easier for developers to proactively monitor their application's performance. By integrating these tools with specialized solutions like Digma.ai, developers can shorten the feedback loop, identifying and addressing issues more swiftly. The post describes how to connect a Spring Boot application to Grafana Cloud and configure Digma.ai for continuous feedback within the IDE, enhancing the development lifecycle with runtime code analysis.
- 19
Community Picks·2y
Efficient containers with Spring Boot 3, Java 21 and CDS by Sébastien Deleuze @ Spring I/O 2024
Sébastien Deleuze explains how to enhance runtime efficiency in Spring Boot applications using Spring Boot 3, Java 21, and Class Data Sharing (CDS). Key focuses include minimizing startup time, reducing memory consumption, and optimizing container deployments. Deleuze introduces features such as native image support, ahead-of-time (AOT) optimizations, and virtual threads, which collectively improve application performance and scalability. He also highlights improvements in developer experience with Spring Boot 3.1 and the integration of CDS in Spring Boot 3.3, demonstrating practical steps and benchmarking results to showcase these optimizations.
- 20
Javarevisited·2y
WSLing Spring Boot with IDEA
Developing Spring Boot applications on Windows can be challenging, but upgrading to IntelliJ IDEA 2024.1.3 has significantly improved the experience. The post provides a comprehensive guide on setting up a self-contained WSL environment for Java development, installing IntelliJ IDEA on Windows, and configuring it to work seamlessly with WSL. The post also compares WSL with Dev Containers, highlighting the space and memory usage considerations for an optimized development setup.
- 21
- 22
Javarevisited·2y
How to collect a Java Stream into a primitive Collection
Discover how to collect a Java Stream into a primitive Collection to avoid boxing. Learn about the options available for transforming a primitive Stream and the usage of Eclipse Collections to bridge Java Stream and primitive collections.
- 23
InfoWorld·2y
HTMX for Java with Spring Boot and Thymeleaf
HTMX enhances HTML with capabilities like Ajax and DOM swaps, simplifying web development. This post showcases building a Todo app using Java with Spring Boot and Thymeleaf, minimizing JavaScript use. It explains creating model and controller classes, utilizing Thymeleaf templates, and handling CSS styling to achieve a robust and interactive application.
- 24
- 25