1 About the port :
The default port of spring boot is 8080. If you want to change it, do the following configuration in the configuration file. ServerProperties.class will read this value.
server: port: 8081
Another way is: if you just want to change the port number once at startup, you can use command line parameters to change the port number. The configuration is as follows: java -jar packaged SpringBoot.jar --server.port=8000
Two @RestController (spring has another annotation @Controller)
That is, the combined annotation of @RestController = @ResponseBody + @Controller.
If the name of the logical view is returned and the page needs to be displayed, you need to use @Controller and cooperate with the view resolver (resolver) to render the page;
If returning JSON directly, you can use @RestController.
三 @Autowired
This annotation is that spring can automatically omit the setter/getter method of the object referenced in the bean for you , and it will automatically set/get for you.
@Autowired annotation, it can annotate class member variables, methods and constructors to complete the automatic assembly work. Eliminate set, get methods through the use of @Autowired .
When the Spring container starts, AutowiredAnnotationBeanPostProcessor will scan all beans in the Spring container. When it finds that the bean has the @Autowired annotation, it will find a bean that matches it (matching by type by default ) , and inject it into the corresponding place.