Spring Cloud Azure 4.0 is Now Generally Available

NOTE: Hi, Spring fans! This is a guest post from Sean Li, our friend at Microsoft I am pleased to announce that Spring Cloud Azure 4.0 is now generally available. With this major release we aim to bring better security, leaner dependencies, support for production readiness and more. Version 4 represents a significant milestone in our product roadmap that we couldn’t have delivered without the collective wisdom of the Spring community and customer feedback.

Add Prefix to All Spring Boot Controllers

1. Introduction In Spring Boot applications, every controller can have its own URL mapping. This makes it easy for a single application to provide web endpoints at multiple locations. For example, we can group our API endpoints into logic groupings such as internal and external. However, there may be times where we want all of our endpoints under a common prefix. In this tutorial, we’ll look at different ways to use a common prefix for all Spring Boot controllers.

About Spring Core Spring Beans Remote Code Warning Notice for Execution 0day Vulnerability

Information indicates that an RCE 0day vulnerability has been reported in the Spring Framework. If the target system is developed using Spring and has a JDK version above JDK9, an unauthorized attacker can exploit this vulnerability to remotely execute arbitrary code on the target device. 1. Vulnerability Situation Analysis The Spring framework is the most widely used lightweight open source framework for Java, and in the JDK9 version of the Spring framework (and above), a remote attacker can obtain an AccessLogValve object through the framework’s parameter binding feature and use malicious field values to trigger the pipeline mechanism and write to a file in an arbitrary path if certain conditions are met.

Getting Started With GraphQL SPQR and Spring Boot

1. Introduction GraphQL is a query and manipulation language for web APIs. One of the libraries that originated to make working with GraphQL more seamless is SPQR. In this tutorial, we’ll learn the basics of GraphQL SPQR and see it in action in a simple Spring Boot project. 2. What Is GraphQL SPQR? GraphQL is a well-known query language created by Facebook. At its core are schemas - files in which we define custom types and functions.

Exposing a Helpful Info Endpoint with Spring Boot Actuator

In a distributed, fast-paced environment, dev teams often want to find out at what time they deployed the app, what version of the app they deployed, what Git commit was deployed, and more. Spring Boot Actuator helps us monitor and manage the application. It exposes various endpoints that provide app health, metrics, and other relevant information. In this article, we will find out how to use Spring Boot Actuator and the Maven/Gradle build plugins to add such information to our projects.

Getting Started With Spring Webflux

Most traditional applications deal with blocking calls or, in other words, synchronous calls. This means that if we want to access a particular resource in a system with most of the threads being busy, then the application would block the new one or wait until the previous threads complete processing its requests. If we want to process Big Data , however, we need to do this with immense speed and agility.

CVE report published for Spring Framework

We have released Spring Framework 5.3.17 to address the following CVE report. CVE-2022-22950: Spring Expression DoS Vulnerability Please review the information in the CVE report and upgrade immediately. Spring Boot users should upgrade to 2.5.11 or 2.6.5. CVE-2022-22950: Spring Expression DoS Vulnerability Severity Medium Vendor Spring by VMware Description In Spring Framework versions 5.3.0 - 5.3.16 and older unsupported versions, it is possible for a user to provide a specially crafted SpEL expression that may cause a denial of service condition.

Resilience and Best Patterns

Monolithic solutions or solutions where a single point of failure can derail an operation is a big problem. In products and platforms that target availability as an essential feature, this problem ends up creating major engineering challenges. This difficulty can be solved with a Microservices architecture. This architecture aims to: Make processes independent and managed in a unique way and without interdependence, so responsibilities are divided and decentralized, something very common in a distributed computing pattern.

Logging MongoDB Queries with Spring Boot

1. Overview When using Spring Data MongoDB, we may need to log to a higher level than the default one. Typically, we may need to see, for example, some additional information such as statement executions or query parameters. In this short tutorial, we’ll see how to modify the MongoDB logging level for queries. 2. Configure MongoDB Queries Logging MongoDB Support offers the MongoOperations interface or its primary MongoTemplate implementation to access data, so all we need is to configure a debug level for the MongoTemplate class.

Send multipart/form-data requests using Resttemplate

A multipart/form-data request can contain multiple sub-request bodies, each with its own separate header and body. Each sub-request body has its own separate header and body, and is typically used for file uploads. Here we use RestTemplate to send a multipart/form-data request. RestTemplate It’s really simple, it’s all in the code. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 package io.

Packaging SpringBoot applications with Docker

Previously, we used Docker to build services related to the development environment, and also to build dependency services in the development and testing environment, and then also used Nexus to build Docker’s self-service, so this time we came together to deploy SpringBoot applications with Docker. Step by step to all the Dockerization march. Build SpringBoot project The project is relatively simple, no data interaction, no complex business, just a print statement.

Spring Authorization Server 0 2 3 Available Now

⭐ New Features Apply default settings for public client type #656 Decompose OAuth2ClientAuthenticationProvider #655 Optimize InMemoryOAuth2AuthorizationService #654 Federated Identity sample #641 Use OAuth2TokenGenerator for OAuth2AuthorizationCode #639 Add OAuth2TokenGenerator implementation for OAuth2RefreshToken #638 Allow Token Introspection to be customized #630 Introduce OAuth2TokenGenerator #628 Add Assert.notNull() for AuthenticationProvider additions #530 Support opaque access tokens #500 Allow Token Introspection to be customized #493 Seperate JWT Token generation #414 Add a login with Google Authorization Server Sample #106 🐞 Bug Fixes Dynamic client registration should not generate client_secret for private_key_jwt #657 /.

Spring Boot 2.6.5 Available Now

⭐ New Features Add EIGHTEEN to JavaVersion enum #30132 🐞 Bug Fixes ConfigurationPropertyName#equals is not symmetric when adapt has removed trailing characters from an element #30392 Thymeleaf auto-configuration in a reactive application can fail due to duplicate templateEngine beans #30385 server.tomcat.keep-alive-timeout is not applied to HTTP/2 #30321 Setting spring.mustache.enabled to false has no effect #30256 bootWar is configured eagerly #30213 Actuator @ReadOperation on Flux cancels request after first element emitted #30161 Unnecessary allocations in Prometheus scraping endpoint #30125 No metrics are bound for R2DBC ConnectionPools that have been wrapped #30100 Condition evaluation report entry for a @ConditionalOnSingleCandidate that does not match due to multiple primary beans isn’t as clear as it could be #30098 Generated password are logged without an “unsuitable for production use” note #30070 Dependency management for Netty tcNative is incomplete leading to possible version conflicts #30038 Files in META-INF are not found when deploying a Gradle-built executable war to a servlet container #30036 Dependency management for Apache Kafka is incomplete #30031 spring-boot-configuration-processor fails compilation due to @DefaultValue with a long value and generates invalid metadata for byte and short properties with out-of-range default values #30022 📔 Documentation Add Apache Kafka to the description of the Messaging section #30389 Default value of spring.

Building Native Images with GraalVM and Spring Native on Apple's M1 Architecture

It finally happened! They did it! They did it just in time for me to get on the road and start building applications on the road with my shiny new laptop, too! JOY!! Oracle and the GraalVM team released GraalVM and the GraalVM native image capability for Apple M1! I’ve been waiting for this day for so, so, so long! I bought the first Apple M1 the day of the announcement way back in 2020 (does anybody remember that far back?

Notes on RabbitMQ with Spring Boot

Introduction Suppose our application organizes asynchronous domain logic inside DomainEventListener’s like the following code snippet. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 interface DomainEventListener { val topic: String fun handle(event: DomainEvent) } @Component class UserRegistered: DomainEventListener { override val topic = "user:registered" // How deserialization is performed is left out. override fun handle(event: DomainEvent) { // perform business logic } } This post shows how to integrate these listeners with Spring AMQP by taking advantage of Spring’s infrastructure.

Moving from Spring Cloud Netflix Zuul to Spring Cloud Gateway

I’ve been using Netflix Zuul for many years as a proxy for APIs. Some weeks ago I tried to bootstrap a new project and add the zuul starter via spring initializr and couldn’t find it anymore. After some research it seems that Spring Cloud has moved over to Cloud Gateway and discontinued Netflix Zuul. Maybe this was just a rebranding of the Spring team but tbh I don’t care and want to follow the Spring Cloud team with that.

Spring Security without the WebSecurityConfigurerAdapter

In Spring Security 5.7.0-M2 we deprecated the WebSecurityConfigurerAdapter , as we encourage users to move towards a component-based security configuration. To assist with the transition to this new style of configuration, we have compiled a list of common use-cases and the suggested alternatives going forward. In the examples below we follow best practice by using the Spring Security lambda DSL and the method HttpSecurity#authorizeHttpRequests to define our authorization rules. If you are new to the lambda DSL you can read about it in this blog post.

Spring Cloud Introduction to Service Discovery Netflix Eureka

Micro-services are all good until they come with their distributed challenges which normally we don’t face in monolithic based applications. Just like this one! Understanding the problem In order to fully get the main purpose of the solution let us first understand the underlying problem. As the diagram above shows, we have to micro-services communicating via a certain network: Micro-service I with the IP address 10.10.10.10 , and port 8080 Micro-service II with the IP address 20.

Messaging with RabbitMQ in Spring Boot Application

In this article, we will learn about RabbitMQ and explore its common use-cases. We will also walk through a step-by-step guide to implement messaging using RabbitMQ in a Spring Boot Application and will see how to publish and consume messages in a queue using RabbitMQ. So, let’s begin learning! What is a RabbitMQ? RabbitMQ is an open-source message broker that allows enterprise applications to communicate with each other. It’s a popular AMQP (Advanced Message Queuing Protocol)broker.

Load Balanced Websockets with Spring Cloud Gateway

The ability to have real-time two-way communication between the client and the server is a key feature in most modern web apps. A simple approach to setting up WebSockets in Spring Boot is covered in Simple WebSockets with Spring Boot, which uses an in-memory message broker. This approach falls short, though, when you scale up and add additional servers. Users connected to different servers would have no way of communicating or getting updates pushed to them for something that’s happened on another server.