Spring-dependency injection findAutowireCandidates source code implementation

findAutowireCandidates() implementation 1. Find the names of all beans of type type in the BeanFactory. Based on the BeanDefinition, you can determine whether they match the current type without generating a Bean object. 2. Find the object whose key is type in resolvableDependencies and add it to result. 3. Traverse the beanName found based on […]

Spring-dependency injection

How many dependency injection methods are there in Spring? Manual injection a) set mode injection <bean name=”userService” class=”com.gax.service.UserService”> <property name=”orderService” ref=”orderService”/> </bean> b) Constructor injection <bean name=”userService” class=”com.gax.service.UserService”> <constructor‐arg index=”0″ ref=”orderService”/> </bean> automatic injection a) XML autowire automatic injection b) Automatic injection of @Autowired annotation Attribute filling part source code: /** * Populate the bean […]

Spring-Spring dependency injection source code analysis (Part 1)

Dependency injection underlying principle flow chart:Dependency injection principle of Bean in Spring | ProcessOn free online drawing, online flow chart, online mind map How many dependency injection methods are there in Spring? First there are two types: Manual injection Automatic injection Manual injection When a Bean is defined in XML, it is injected manually, because […]

Go etcd dependency problem is finally solved. . .

Hello everyone, I am fried fish. In the past few years, I have been exposed to a bunch of microservice-related components very frequently: grpc + grpc-gateway + etcd + protobuf + protoc-gen-go. At first, everything was fine, and we gradually followed up with new versions. No, the moth is here. The development leaders (or companies) […]

[Spring] DI dependency injection, Lombok and SpEL

Article directory 1.What is DI dependency injection 2. set method injection 3. ref attribute 4. Parametric constructor injection 5. Lombok 6.SpEL 1. What is DI dependency injection Dependency Injection (DI) is a design pattern and one of the core concepts of the Spring framework. The basic idea is to transfer the dependencies between the various […]

JUnit5 dependency injection and testing interface!

Dependency Injection The previous JUnit class construction methods and test methods could not have parameters. JUnit Jupiter has a disruptive improvement, which is to allow them to have parameters, so that dependency injection can be done. If you are familiar with pytest fixtures, you will know how powerful this technology is. ParameterResolver is an interface […]

Best practices for gradle multi-module dependency management

Gradle multi-module dependency management best practices Multi-module project dependency management Define submodules Use buildSrc to define plugins SofastModulePlugin Optional dependencies Add dependencies submodule Other submodules web Multi-module project dependency management Dependency management is an essential operation in the project development process. How to elegantly manage multiple module dependencies in Gradle is a question worth exploring. […]

If the new Feign interface is started according to the microservice, an error will be reported: org.springframework.beans.factory.UnsatisfiedDependencyException:

Startup error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘jgEntInfoController’: Unsatisfied dependency expressed through field ‘remoteJgEntInfoService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ com.supervise.system.api.RemoteJgEntInfoService’: Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com.supervise.system.api.factory.RemoteJgEntInfoFallbackFactory found for feign client remoteJgEntInfoService question: rg.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean named ‘jgEntInfoController’: Dependency […]

Spring three-level cache solves circular dependency problem

Article directory 1. Problem scenarios solved by level 3 cache 2. Differences in Level 3 Cache 3. Processing flow for circular dependencies 4. Source code verification 1. Problem scenarios solved by level 3 cache Circular dependency refers to the interdependence between objects, forming a closed loop, resulting in the inability to accurately complete the creation […]

org.springframework.beans.factory.UnsatisfiedDependencyException Error creating bean with name class

Someone said they wanted to see: org.springframework.beans.factory.UnsatisfiedDependencyException exception solution, so today, he is here! ! ! ! When you first started working on SpringBoot, you were high-spirited and unmotivated. With the great goal of abandoning the cumbersome configuration of traditional MVC, you eagerly embraced the SpringBoot framework model because you know the core of springboot: […]