3. Project Structure

As the name suggests Spring MVC, look at the above diagram we are using Model-View-Controller approach.

Model - SignUpForm.java

Views - signup-form.jsp and signup-success.jsp

Controller - SignUpController.java

Next step, we will configure Spring beans using Java-based configuration.

4. Spring Configuration - MVCConfig.java

Create an MVCConfig class and annotated with @Configuration, @EnableWebMvc, and @ComponentScan annotations. In this MVCConfig class, we configure the resource handler to serve the static resources (CSS, JavaScript or Images) in spring MVC application.

To configure the resource handler, we need to override the default addResourceHandlers() method of WebMvcConfigurer interface in our web @Configuration class as follows.