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

Advanced Android – RxJava

I. Introduction RxJava is a reactive programming framework developed by Netflix based on the Java Virtual Machine . It belongs to the ReactiveX open-source project and aims to simplify the development process of asynchronous programming and event-driven programs. This framework extends the observer pattern to support the composition of observable objects for processing data streams and … Read more

Java Distributed Lock

1. The concept of distributed locks A distributed lock is a mechanism for coordinating mutual exclusion access to shared resources by multiple processes/services in a distributed system. In a single-machine system, we can use Java’s built-in locking mechanisms (such as synchronized` synchronized` and ` ReentrantLocksynchronized`) to achieve thread synchronization. However, in a distributed environment, these native locking … Read more