I. What is Springboot
Spring Boot is the starting point for all spring-based projects. Spring Boot is designed to allow you to run the spring application as quickly as possible and to minimize your configuration files. Greatly reduce the programmer in spring or Springmvc to spend a lot of time to configure, do not need to consider the configuration of various XML files, simple, fast, convenient! Using Spring Boot to develop a project requires very few configurations to build a Web project, and the idea can be used to generate the build automatically.
Two. Build Springboot Project
Create Springboot project with idea very quickly, click NewProject click Spring Initializr, fill in the project name as follows:
Click Next, select a good web in the project configuration, continue to click to know the finish, as follows:
Delete redundant files and clean up the project structure :
Finally add some configuration, page, etc.,
Add a controller, write a method, because Springboot built-in Tomcat, so you can now launch the Springboot's only project portal to access the project, default port 8080:
Three. Access to the project via local tomcat
1. Preferred to avoid conflicts, remove the springboot contained tomcat:
2. main function entry to inherit the Springbootservletinitializer class and override the Configure method:
So, a simple springboot framework is done!
Four. Tomcat container certification-form validation
Just the new entry of the company landing page to get permission to use the Tomcat container Authentication-form verification, the customer just need to configure a set of identical authentication methods, hereby collect information to verify the learning!
When the Auth-method element in the Web. xml file is set to form, it indicates that the application is using form validation. When a user requests a protected resource from a Web application, form validation jumps to the configured login page. When the login fails, you also need a validation failed page, or the above example, look at the configuration:
It is particularly important to note that the login page name and password names and attributes are written dead, such as:
Note: Here form's action= "J_security_check", the account Name= "J_username" and the password Name= "J_password" are immutable, otherwise the configured validation rule does not work. General password account in the Tomcat configuration file Tomcat-users.xml in the use of clear text to save the password, the company applied an interface filtering class to judge, here is no longer described too much.
Introduce front-end dependency and servlet dependencies in Pom.xml, launch project, Access login page, enter account password, Access success!
Run the company project and the project into the same tomcat, and successfully get permission after the project is logged in! At this point, tomorrow can be deployed to customers again!
About Springboot the Tomcat container certification form validation