Previously we use Application Context to get Bean and Dependenies injection. It is actually easier to use 'CommonLineRunner'.
Main beneift is we can use @Autowired.
@SpringBootApplication public class SpringAopApplication implements CommandLineRunner{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private Business1 business1; @Autowired private Business2 business2; public static void main(String[] args) { SpringApplication.run(SpringAopApplication.class, args); } @Override public void run(String... args) throws Exception { logger.info(business1.calculateSomething()); logger.info(business2.calculateSomething()); } }