Nacos: Services and Configuration in the Cloud-Native Era

Introduction: The Challenges of Microservice Architecture and the Birth of Nacos Driven by cloud computing and containerization technologies, microservice architecture has become the mainstream paradigm for modern application development. However, with the exponential growth in the number of services, traditional service governance models face three core challenges: inefficient service discovery mechanisms, lack of a unified … Read more

Kafka producers

When sending messages using Spring Boot and Kafka, we only need to inject the corresponding type of KafkaTemplate and call the send method, which is very simple. The simplicity of operation actually implies a lot of internal details are encapsulated. This article is used to analyze the Kafka producer in detail. Message partitioning algorithm In … Read more

Spring IOC Implementation Principles: Timing of Container and Object Creation

Bean lifecycle Initialize container In contrast  , lazy-loaded containers  create objects BeanFactory only on the first invocation  .getBean() Parse the configuration and generate BeanDefinition Spring first reads the configuration file (such as XML or annotations), and parses  <bean> the definitions in the tags, for example: This information will be encapsulated into  BeanDefinition an object that describes the Bean’s metadata, including: property illustrate … Read more

Solutions for Spring Boot projects failing to start when integrating Elasticsearch

1. Bean definition conflict 1. MyBatis and Elasticsearch Repository scan path conflict Error message : reason : Solution : II. Dependency Configuration Issues 1. Missing or incompatible dependencies. Error message : reason : Solution : <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId> <!– Exclude Netty dependencies that may cause conflicts –> <exclusions> <exclusion> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </exclusion> </exclusions></dependency> III. Elasticsearch service connection issues 1. The Elasticsearch … Read more

Git Command Reference

Basic operations # Initialize repositorygit init# Clone remote repositorygit clone <repo_url># View current statusgit status# Add all modifications to the temporary storage areagit add .# Submit to local warehousegit commit -m “submission common”# View Submission History git log –oneline# View file modification differencesgit diff Branch Management # Create a new branchgit branch <branch_name># switch branchgit … Read more

In Git, there are methods to undo (roll back) a merge operation

In Git, there are several ways to undo (rollback) merge an operation, depending on whether a commit has been made, whether a push has been made, and whether a history needs to be retained. Here are some common undo  merge methods: 1. Not submitted  merge (not submitted  commit) If  merge you haven’t submitted it yet, you can use the following methods to undo … Read more

Advanced Git Local Operations: Version Revert, Undo Changes, and File Deletion

Foreword: After mastering the basic operations of a Git local repository, “how to correct erroneous commits,” “how to recover accidentally deleted files,” and “the risks and solutions for version rollback” become key topics for developers to advance. In code development, accidental changes to configurations, committing redundant files, and deleting core code are unavoidable. Git’s version rollback, … Read more

Spring Cloud Microservice Full-Stack Practice

1. Overview and Positioning 1.1 Background and Challenges of Microservices Microservices break down business logic into multiple autonomous mini-services that evolve as independent deployment units. While this brings decoupling to teams and improved delivery efficiency, it also introduces runtime governance challenges: service discovery, configuration distribution, interface compatibility, fault tolerance and resilience, observability and capacity planning, … Read more

Java Lockless Programming

   In Java, explicit locks such as `synchronized` and the `Lock` interface can be used to control access to and modification of critical section resources by multiple threads, ensuring thread safety. However, Java also provides lockless programming methods to achieve the same goal while maintaining thread safety. Lockless programming in Java is primarily implemented using `volatile` … Read more

Spring Boot startup execution process

Core Process Overview In Spring Boot applications, we typically write a class containing a main method and call `SpringApplication.run`.Example code: The entire startup process can be summarized as: constructing  SpringApplication an object -> executing  run a method -> starting the embedded server -> completing application startup . Phase 1: SpringApplication Instantiation Execution method:new SpringApplication(primarySources) At this point, SpringApplication the object has been constructed, and its … Read more