JAVA-16301: Check Article Code Matches GitHub

This commit is contained in:
freelansam
2022-12-02 18:45:30 +05:30
parent 6aebc37921
commit 998415cd47
12 changed files with 149 additions and 13 deletions
@@ -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 + '\'' +
'}';
}
}