Removed boilerplate code

This commit is contained in:
Anirban Chatterjee 2020-10-07 09:32:33 +02:00
parent bd53673e2b
commit d27cbbc4a6
5 changed files with 21 additions and 7 deletions

View File

@ -14,12 +14,6 @@ import org.springframework.context.annotation.ComponentScan;
//@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"})
public class EmployeeApplication {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(EmployeeApplication.class, args);
System.out.println("Configures Employee: " + context.containsBeanDefinition("employee"));
System.out.println("Configures Senior Employee: " + context.containsBeanDefinition("seniorEmployee"));
System.out.println("Configures Doctor: " + context.containsBeanDefinition("doctor"));
System.out.println("Configures Hospital: " + context.containsBeanDefinition("hospital"));
System.out.println("Configures Student: " + context.containsBeanDefinition("student"));
System.out.println("Configures Teacher: " + context.containsBeanDefinition("teacher"));
SpringApplication.run(EmployeeApplication.class, args);
}
}

View File

@ -4,4 +4,9 @@ import org.springframework.stereotype.Component;
@Component("employee")
public class Employee {
@Override
public String toString() {
return "Employee" + this.hashCode();
}
}

View File

@ -4,4 +4,9 @@ import org.springframework.stereotype.Component;
@Component
public class SeniorEmployee {
@Override
public String toString() {
return "Senior Employee" + this.hashCode();
}
}

View File

@ -4,4 +4,9 @@ import org.springframework.stereotype.Component;
@Component("student")
public class Student {
@Override
public String toString() {
return "Student" + this.hashCode();
}
}

View File

@ -4,4 +4,9 @@ import org.springframework.stereotype.Component;
@Component("teacher")
public class Teacher {
@Override
public String toString() {
return "Teacher" + this.hashCode();
}
}