@Qualifier 注解作用就是为了给Bean打上一个标记,用来查找bean,代码示例:
- 创建一个java bean
package com.gupaoedu.springcloud.example.demo;
public class TestClass {
private String name; // getter setter 略
}
- 编写配置类,将这个bean装载到IOC容器
package com.gupaoedu.springcloud.example.demo;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public