O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

We will not go into the working of Spring Boot or the other Spring libraries. But to state in brief, Spring Boot creates an embedded Tomcat running on the default port, that is, 8080. It then registers all the controllers, components, and services that are available in the packages and sub packages of the class with the annotation, @SpringBootApplication.

In our recipe, the BootDemoApplication class in the com.packt.boot_demo package is annotated with @SpringBootApplication. So, all the classes that are annotated with @Controller, @Service, @Configuration, @Component, and the likes of it get registered with the Spring framework as beans and are managed by it. Now, these can be injected into the code by using the @Autowired ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required