Types of Spring MVC applications
2. Web Reactive
What is the starter for Spring MVC?
spring-boot-starter-web
What jar files that spring-boot-starter-web includes?
spring-web.jar spring-webmvc.jar spring-boot-starter.jar jackson*.jar tomcat-embed.jar
Does the web starter depend on the validation starter?
No
List out Spring MVC components created at startup time
What is the processing lifecycle of a REST request?
client -> DispatcherServlet -> Controller -> MessageConverter -> DispatcherServlet -> client
What are message-converters in Spring MVC?
If found on the classpath, Spring will use:
Note:
When need to use @ResponseBody?
In the controller class with @Controller, the method needs to mark with @ResponseBody to convert the return object to JSON before sending it to the client. We don't need this in @RestController controller class
How can Spring lookup for @PathVariable, @RequestParam parameters without a name? e.g. @PathVariable long accountId
-parametersHow to set a request parameter optional?
@RequestParam(required=false) Integer location
How to enable message converters?
How to customize message-converters?
How to replace embedded tomcat with jetty?
In pom.xml,
How to configure to run the app from both the command line and web container?
What does mvn package produce?
2. app-0.0.1.jar.original: traditional jar
What is the starter for spring mvc and web?
spring-boot-starter-web
What plugin builds fat & executable jar?
spring-boot-maven-plugin
What is the purpose of @EnableWebMvc?
Without Spring Boot, we need to use @EnableWebMvc to:
What if you add @EnableWebMvc to a Spring Boot app?
All extra configs from Spring Boot will disappear
List out template engines supported by Spring MVC
What is the front controller in MVC-based applications?
DispatcherServlet