JAVA-16301: Check Article Code Matches GitHub
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.baeldung.sample;
|
||||
|
||||
/**
|
||||
* Created by Gebruiker on 7/17/2018.
|
||||
*/
|
||||
public class Employee {
|
||||
|
||||
private String name;
|
||||
|
||||
public Employee(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Employee{" +
|
||||
"name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user