Spring Boot tutorial (a): New Spring Boot using the IDEA project, realized hello word

1. Download and install jdk1.8, jdk1.8 then configure the idea of: file-Project Structure
shown + jdk1.8 introduced to save and exit in the idea within the click Figure
Here Insert Picture Description
2. New spring boot project, select Shown item, select the next
Here Insert Picture Description
of which is the ability to generate https://start.spring.io/ spring boot project site online, you can use the site to generate spring boot project when using eclipce as editor
Here Insert Picture Description
3. here you can modify the project directory, I the Artifact and demo2 Name changed, the effect of generating a directory as shown in FIG second, for reference. Here Insert Picture Description

4. I use the idea 2019.1.3, select the drawing options, next, waiting for the completion of the project initialization Here Insert Picture Description
5. update the look maven, right-click the project in the pop-up menu, select the menu item Maven-Reimport
6. New directory controller, and helloController new class, add the following, and incorporated jar package:
@RestController
public class {helloController in
@RequestMapping ( "/ Hello")
public String Hello () {
return "Hello World";
}
}
where a few points to note and explained:
one: why the new controller directory in the figure at somewhere else instead?
The reason: spring-boot will automatically load at startup class that is where the package Demo1Application and all its components under the sub-packages, if placed in another directory, it will not scan, will result in the browser can not access to
two: the introduction jar package, annotations or check a subject in need references, alt + enter
three: formatting code shortcut: ctrl + alt + L
four: rename categories: Shift + F6
Here Insert Picture Description
7. the project started, Demo1Application right, run.
Here Insert Picture Description
8. Start to be completed, visit our Web site http://127.0.0.1:8080/hello, I congratulate you once again hello a word, to this end hello word

I wish I could adhere to write down, until the five common components are finished spring cloud

Each piece is followed by Bowen novel fragments like to share with you: the
need to deliberately hard to suppress the realm of Regulus King City, raising his hand from a potential.
Step right foot trod, left knees slightly.
Suddenly, the sky, such as clouds rotating tornadoes, plummeted.
Regulus King City softly:. "I shake Kunlun"
"Regulus King City, please ancestors to die"
has been silent sigh of Chun Li Gang said:. "This kid is where scholars, Confucianism is clearly already a saint."

Guess you like

Origin blog.csdn.net/qq_35168817/article/details/95200752