Spring Boot Annotations and managed objects
CDI Contexts and Dependency Injection provides the programmer with a mechanism that automatically manages class instances. The main advantages are: No need to create classes using the new keyword ; No need to pass a class instance to call its method in a different class. For comparison Code written in Java SE: 1 2 3 4 5 public class Hello { public String sayHallo() { return "Hello!" ; } } 1 2 3 4 5 6 public class Sample { public static void main(String[] args) { Hello hello = new Hello(); hello.sayHallo(); } } The code written in Spring 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @SpringBootApplication publ...