Analysis of a memory overflow caused by Spring Cloud Netflix Core

Problem found The online service was restarted, and it was good to get the dump file of the online service and download it locally for analysis. Opened the snapshot file using MAT, omitted the process of using MAT here, and found that there was a large amount of com.netflix.servo.monitor.BasicTimer that was not released and was occupied by org.springframework.cloud.netflix.metrics.servo. ServoMonitorCache is occupied. Analysis Find the ServoMonitorCache class in the project, found under the spring-cloud-netflix-core package, then open the jar package, check its spring.

Get Request object anywhere in Spring WebFlux

1 A different world In a regular Spring Web project, it is very easy to get the Request object, and quite a few libraries provide static methods to do so. The code to get it is as follows. 1 2 3 ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); // get the request HttpServletRequest request = requestAttributes.getRequest(); In class RequestContextHolder provides static methods, which means you can call them anywhere. And it uses ThreadLocal to hold the Request object, which means that different threads are able to get their own Request objects.

Log4j maintainer: old features that lead to vulnerabilities not removed for backward compatibility

The recently disclosed remote code execution vulnerability in Apache Log4j2, a Java-based logging component, has caused significant impact worldwide. This component is used extensively in business system development to record logging information about program input and output, and is extremely widely used. In most cases, developers write error messages caused by user input to the log. The sudden disclosure of this vulnerability has not only caused developers using Log4j2 to “fix” the problem overnight, but also caught the framework maintainers off guard.

Integrating Spring Cloud Stream Binder with GCP Pubsub for message sending and receiving

1 Preface This article will briefly introduce the integration of Spring Cloud Stream with Google Cloud Pub/Sub. 2 Starting Pub/Sub via Emulator Since it is relatively troublesome to use the actual GCP Pub/Sub, this article runs through the emulator. For the installation of Google Cloud SDK, please refer to: Installing Google Cloud SDK for Mac Install the necessary components. 1 2 gcloud components install beta gcloud components install pubsub-emulator To start the simulator.

Integrating Spring Cloud Stream Binder with RabbitMQ for message sending and receiving

1 Preface Spring Cloud Stream is designed for event-driven microservices systems that use messaging middleware to send and receive messages. Using Spring Cloud Stream allows you to focus on business development without spending too much effort on the interaction between the application and the MQ. Also, you don’t have to make many code changes after switching to MQ. In this article, we will integrate Spring Cloud Stream and RabbitMQ to send and receive messages.

Getting Started with Spring Cloud Data Flow and Confluent Cloud

Data is the currency of competitive advantage in today’s digital age. All organizations struggle with their data due to the sheer variety of data types and ways that it can be shaped, packaged, and evaluated. Within organizations, teams use different tools, fragmented rule sets, and multiple sources to find value within the data. These operational differences lead to divergent definitions of data and a siloed understanding of the ecosystem. These challenges have led to the rise of several new technologies, including Apache Kafka® and Spring Cloud Data Flow.

Log4J2 Vulnerability and Spring Boot

As you may have seen in the news, a new zero-day exploit has been reported against the popular Log4J2 library which can allow an attacker to remotely execute code. The vulnerability has been reported with CVE-2021-44228 against the log4j-core jar and has been fixed in Log4J v2.15.0. Spring Boot users are only affected by this vulnerability if they have switched the default logging system to Log4J2. The log4j-to-slf4j and log4j-api jars that we include in spring-boot-starter-logging cannot be exploited on their own.

Spring Cloud Stream with Schema Registry and Kafka

In this article, you will learn how to use Confluent Schema Registry with Spring Cloud Stream and Kafka in a microservices architecture. We will use Apache Avro to serialize and deserialize events exchanged between our applications. Spring Cloud Stream provides a handy mechanism for integration with Kafka and schema registry. Ok, but before we start, let’s say some words about schema registry. What is this? And why we may use it in our event-driven architecture?

Writing into DynamoDB in a Spring Boot App using AWS Lambda

In this tutorial, we are going to see how to insert records into a DynamoDB table using an AWS Lambda function written using Spring Boot Java. We are also going to add an AWS API Gateway trigger to the Lambda function and see how it works. To follow this tutorial, make sure that you have an active AWS account. If you don’t go ahead and create one. Database setup Before we begin with the Spring Boot application development, we need to create a DynamoDB table.

Spring Retry

Spring Retry provides the ability to automatically re-invoke a failed operation. This is helpful when errors may be transient in nature. For example, a momentary network glitch, network outage, server down, or deadlock. You can configure the spring-retry module using annotations. You can define the retry limits, fallback methods, etc. In this post, you will learn how to use the spring-retry module. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <dependency> <groupId>org.

New AOT Engine Brings Spring Native to the Next Level

On behalf of the team and everyone who has contributed, it is my pleasure to announce the release of Spring Native 0.11, which provides native support for Spring Boot 2.6. This ambitious release is the result of five months of hard work by the Spring team, who have been working on a brand new architecture to bring Spring support for creating native executables with GraalVM to the next level. You can already try it on start.

Spring Cloud Gateway and gRPC

Starting from version 3.1.0 as part of the Spring Cloud 2021.0.0 (aka Jubilee) release train, Spring Cloud Gateway included support for gRPC and HTTP/2. We will introduce the basic concepts behind gRPC and how to configure it with two examples: One that showcases how Spring Cloud Gateway can transparently re-route gRPC traffic without needing to know the proto definition and without having to modify our existing gRPC servers. Another that showcases how we can create a custom filter in Spring Cloud Gateway to transform a JSON payload to a gRPC message.

Event Driven Microservices with Spring Cloud Stream and RabbitMQ

The world of microservices is dominated by REST based applications. When we talk about microservices, a natural assumption is a set of individual services talking to each other over HTTP(S) REST. But Event-Driven microservices have important and crucial roles to play in any modern, cloud-based architecture. The usage of events to communicate application states or data is not a new concept. Organizations have been using messaging systems such as IBM MQ for several decades.

Getting started with Spring Cloud Config

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems. Coordination of distributed systems leads to boilerplate patterns, and using Spring Cloud developers can quickly run services and applications that implement those patterns. They will work well in any distributed environment, including the developer’s laptop, bare metal data centers, and managed platforms such as Cloud Foundry. In this article, I would like to discuss Spring Cloud Config.

Spring Cloud Config Server - Encryption and Decryption

While using Spring Cloud Config Server, we also have the feature to encrypt sensitive information that is otherwise stored as plain text in our external git repository. This prevents anyone who has read access to the external repository from accessing confidential information and is highly highly recommended if you are using a Spring Cloud Config Server. Note: If you haven’t set up Spring Cloud Config Server yet check out my other article on how to set up a spring cloud config server.

Develop Spring Boot App with HANA Cloud in Cloud Foundry

Through this post, you can get: How to build a Spring Boot App consuming HANA Cloud How to deploy Spring Boot App in SAP BTP Cloud Foundry Environment Comparison between consuming HANA Cloud instance directly and through hdi-shared / schema Comparison between consuming HANA Cloud with JDBC and JPA Comparison between HANA Cloud users and their authorizations How to get Trial Account on SAP BTP@AliCloud Trial Account (SAP BTP@AliCloud) If you are an SAP employee , access SAP BTP Control Center – Canary – Alibaba Cloud to grant the service entitlements to your Global Account.

An Intro to Dapr with Spring Cloud Gateway

1. Overview In this article, we’ll start with a Spring Cloud Gateway application and a Spring Boot application. Then, we’ll update it to use Dapr (Distributed Application Runtime) instead. Finally, we’ll update the Dapr configuration to show the flexibility that Dapr provides when integrating with cloud-native components . 2. Intro to Dapr With Dapr, we can manage the deployment of a cloud-native application without any impact on the application itself. Dapr uses the sidecar pattern to off-load deployment concerns from the application, which allows us to deploy it into other environments (such as on-premise, different proprietary Cloud platforms, Kubernetes, and others) without any changes to the application itself .

The best way to log SQL statements with Spring Boot

Introduction In this article, I’m going to show you the best way to log SQL statements when using Spring Boot. Logging SQL queries is very important, as it allows you to validate the number of generated statements, the syntax of the auto-generated queries, as well as prove that JDBC batching works as expected. Don’t log SQL statements with the Spring Boot show-sql property It’s very common for a Spring Boot application to store data in a relational database, and, most often, Spring Data JPA is the default data access technology.

Spring Cloud Streams with Apache Kafka

Have you ever wondered how features like Google Maps’ live traffic work? These systems have to gather and process data in real-time. The architecture of these systems generally involves a data pipeline that processes and transfers data to be processed further until it reaches the clients. In this article, we will see something similar with a simple example using Kafka Streams. The sample app can be found here. Introduction to Spring Cloud Stream Spring Cloud Stream is a framework designed to support stream processing provided by various messaging systems like Apache Kafka, RabbitMQ, etc.

AWS Lambda with Kotlin and Spring Cloud Function

AWS Lambda is a great technology to get your code up and running in a matter of minutes. I’m heavily using AWS Lambda for various automation and marketing tasks for this blog and my online courses. I recently gave Spring Cloud Function with Kotlin for AWS Lambda a try. It’s a powerful combination if you’re familiar with the Spring ecosystem and want to use the same techniques for your Lambda functions.