注入优先(@Primary)

Exisi 2022-11-28 08:07:34
Categories: Tags:

示例

@Bean

public Employee tomEmployee(){

    return new Employee("Tom");

}

 

@Bean

@Primary

public Employee johnEmployee(){

    return new Employee("john");

}