Unified configuration management using Spring Cloud Config

1 Preface Configurability is a feature that a mature software system should provide, and configuration management is important for large systems, especially for microservices systems with multiple applications. Happily, Spring provides us with good configuration management, such as the powerful configuration of Springboot. For Spring Cloud, there is the powerful Spring Cloud Config which is very useful for distributed system configuration management by providing a configuration management outside the application,

Getting Started with Data Flow Shell

1 Preface In the previous article about Spring Cloud Data Flow, the examples were operated through the UI. The Linux server environment generally uses the command line. The integration on Jenkins does not work with the UI either. The good thing is that the official Data Flow Shell tool is available and can be operated in command line mode, which is very convenient. The Spring Cloud Data Flow Server provides an operational REST API, so the essence of this Shell tool is still to interact by calling the REST API.

Getting Started with Spring Cloud Data Flow, Running in Local Mode

1 Preface What is Spring Cloud Data Flow, although it has been around for a while, I think many people don’t know about it, because few people use it in their projects. Not much information can be found online. Spring Cloud Data Flow is a microservices-based, specialized framework for streaming and batch data processing. 2 Basic concepts 2.1 Data Processing Modes There are two modes of data processing, Streaming and

Solve the problem that SpringBoot fails to start after updating to 2.6.0

Problem Description SpringBoot project has integrated springfox. After updating SpringBoot to 2.6.0 the application fails to start and throws an exception: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException. The exception stack is as follows. 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 56 Error starting ApplicationContext.

4 solutions for selective injection when the interface has multiple implementations

1. Description of the problem In the actual system application development I often encounter such a class of requirements, and I believe that you will often encounter in your work. The same system is deployed in multiple provinces. A business in Beijing is one way of implementation, based on the needs of Beijing users. The same business is implemented in Shanghai in another way, much the same way as in

Deadlock problem caused by improper use of ThreadPoolTaskExecutor

Spring comes with a thread pool is very convenient to use, but in relatively complex concurrent programming scenarios, the use of the scenario still requires careful consideration of the configuration, or you may encounter the pitfalls mentioned in this article. Specific code reference sample project 1. Overview ThredPoolTaskExcutor has 2 core configurations, one is the thread pool size and one is the queue size. The processing flow of ThredPoolTaskExcutor: New

Spring Cache custom resolver

This article introduces the custom cache resolver in spring, by customizing the resolver, you can add additional processing in spring’s cache annotation. Specific code reference example project 1. Overview The cache-aside pattern is a commonly used cache usage pattern. The usage flow is as follows. When the data in the database is updated, the cache is invalidated so that the latest data in the database can be read subsequently, making the cached data consistent with the database data.

Problems encountered in migrating small microservices from Java to Kotlin and their solutions

In this article, I would like to consider the problems and their solutions, which we encountered during the migration of our small microservice from Java to Kotlin. Stack Java 11 Spring Web MVC (в рамках Spring Boot) Spring Data JPA Map Struct Lombok Maven Beginning Firstly, I would recommend anyone, who wants to put Kotlin in your project to start from tests. During this process, we configure almost all you need.

Spring Boot integration groovy script

Introducing scripting capabilities into our application can be a good way to improve flexibility. Our core development work can be focused on the development of core platform capabilities, and scenario-specific functionality can be implemented through scripting. For example, jenkins can write pipelines through groovy scripts, which can be very flexible to customize the build process. spring itself provides a mechanism for groovy integration, divided into two ways, one is to use groovy development program, similar to the development with java, need to be compiled.

Downgrading to Java 8 can also solve Spring Framework RCE

Yesterday we announced a Spring Framework RCE vulnerability CVE-2022-22965, listing Apache Tomcat as one of several preconditions. The Apache Tomcat team has since released versions 10.0.20 , 9.0.62 , and 8.5.78 all of which close the attack vector on Tomcat’s side. While the vulnerability is not in Tomcat itself, in real world situations, it is important to be able to choose among multiple upgrade paths that in turn provides flexibility and layered protection.

Nacos Configuration Center Cluster Principle and Source Code Analysis

Nacos, as a configuration center, necessarily needs to ensure high availability of service nodes, so how does Nacos implement clustering? The following diagram, represents the deployment diagram of Nacos cluster. How Nacos clusters work Nacos is an uncentralized node design in the cluster architecture as a configuration center. Since there are no master-slave nodes and no election mechanism, it is necessary to add virtual IPs (VIPs) in order to enable hot standby.

Send a SOAP Object with Feign Client

1. Overview Feign abstracts the HTTP calls and makes them declarative. By doing so, Feign hides the lower-level details like HTTP connection management, hardcoded-URLs, and other boilerplate code. The significant advantage of using Feign clients is that HTTP calls are made easy and eliminate a lot of code. Typically, we use the Feign for REST APIs application/json media type. However, the Feign clients work well with other media types like text/xml , multipart requests, etc.

Spring Framework RCE, Early Announcement

Updates: [15:40 BST] Spring Boot 2.6.6 is available. [14:38 BST] Spring Boot 2.5.12 is available. [14:00 BST] CVE-2022-22965 is published. [13:03 BST] Added section “Misconceptions”. [12:34 BST] Added section “Am I Impacted”. [12:11 BST] Fix minor issue in the workaround for adding disallowedFields . [11:59 BST] Spring Framework versions 5.3.18 and 5.2.20 , which address the vulnerability, are now available. The release process for Spring Boot is in progress. Overview I would like to announce an RCE vulnerability in the Spring Framework that was leaked out ahead of CVE publication.

Spring cache source code analysis

Spring cache is a caching API layer that encapsulates common operations for a variety of caches and can easily add caching functionality to your application with the help of annotations. The common annotations are @Cacheable, @CachePut, @CacheEvict, ever wondered what is the principle behind them? With questions, after reading the source code of Spring cache, make a brief summary. First the conclusion, the core logic in the CacheAspectSupport class ,

Complete Guide to Spring RestTemplate

REST-styled APIs are all around us. Many applications need to invoke REST APIs for some or all of their functions. Hence for applications to function gracefully, they need to consume APIs elegantly and consistently. RestTemplate is a class within the Spring framework that helps us to do just that. In this tutorial, we will understand how to use RestTemplate for invoking REST APIs of different shapes. Example Code This article is accompanied by a working code example on GitHub.

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.