2022-12-02 18:45:30 +05:30

23 lines
544 B
Java

package com.baeldung.sample;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@Configuration
@ComponentScan(basePackages="com.baeldung.primary")
public class Config {
@Bean
public Employee johnEmployee(){
return new Employee("John");
}
@Bean
@Primary
public Employee tonyEmployee(){
return new Employee("Tony");
}
}