springboot quality development experience, we can more quickly build project production environment. This article is a super simple entry springboot project. It contains some simple theory and super-simple Controller layer
【tool】
IDEA stands for IntelliJ IDEA
SpringBoot
[Create] to open the IDEA project editor, the new project, and then select Spring Initializr.
Choose your native SDK. Then select initializr service url recommended to choose Custom written content: https: //start.spring.io/ because creating out Default is not necessarily useful. Although the two are the same address filled out
And then wait for retrieving Spring initializr option, this maven I use. Click Next
The choice depends :( because it is the entry-web) we select the Web Click: Next
Then fill in the project name and storage path. Click: Finish to that we have created, a simple project SpringBoot
Figure: We can see the directory structure
Open: DemoApplication this class, direct run the main method.
Note: springboot built tomcat server, so we only need to run the main method can be used.
Top right, select Application Configuration, then click on the green triangle run, or stink bug debugging.
Figure been run successfully.
Please note that a successful first start the console output! ! ! Contains the program path, port, Servlet engine, Tomcat version information.
Open your browser address bar enter localhost: 8080, Enter, you will see the following error:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Page not found normal, we do not build their own Controller, then go down:
[New] First Controller: Right on the package, the new Java Class Figure:
Write controller name aaaController, Enter:
Write test code shown:
The first test MVC controller
Run again, and add the path to access the specific page from the browser address bar:
In fact, it is basically to complete.
Dividing line
There is also a port configuration problem. In this way we introduce the project configuration file: resources of file folder application.properties
Open Input: server.port = 8082 is set to complete. Figure:
Also say a skill, tool window that idea more, left, right, bottom of the window is not there more trouble?
You can set the point of a small icon in the upper right corner of each window, and then select View Mode Undock, Chinese means "let go", that is automatic retractable, automatically pop up when an event is triggered, usually automatically hide Collage.
【Finish】