inotgo.com

Download area
File name File size
springboot.rar 1k
Use the webmaster secret download tool

Tool version compatibility problem
I'm learning SSM(H) In the process of , A lot of configuration work needs to be done , In fact, many configuration behaviors are only means , Not the end . Based on this consideration , Simplify what should be simplified , The omission of the omission , Developers only care about providing business functionality , This is it. SpringBoot.

In other words ,SpringBoot It can be simply seen as a simplified 、 Developed as agreed SSM(H). The development speed has been greatly improved . But what , Better still SSM(H) Basis of , Otherwise, it uses Spring MVC,Mybatis,Hibernate Place , Or feel confused .

notes : In parentheses (H) express Hibernate.
Correct

Step 1 : About environment version   
Step 2 : about SpringBoot edition   
Step 3 : about IDE   
Step 4 : about STS plug-in unit   
Step 5 : Run... First , See the effect , Learn again   
Step 6 : Imitation and troubleshooting   
Step 7 : about Tomcat   
Step 8 : Create project   
Step 9 : Enter project parameters   
Step 10 : pom.xml   
Step 11 : Application.java   
Step 12 : HelloController.java   
Step 13 : Run and test   

Try to use JDK8 32 edition , lower than 8 Definitely not , higher than 8 Schrodinger BUG, Try to use 8, Please download JDK8: Download and configure JDK environment

Eclipse Also try to use the information provided by the webmaster , Avoid problems caused by environmental reasons : Eclipse

notes : JDK8 64 Bit version is the same as that provided by the current project jar Package incompatible , Please use Provided by the station master 32 Bit .
This series of tutorials uses 1.5.9.RELEASE, Now there are updates Springboot 2.x Version .
Their usage is similar , But there are still some differences .

I hope the students will be here first 1.5.9.RELEASE Study on the basis of 、 master 、 After proficiency , If you are still interested , Then switch to 2.x Version on .
What I want to emphasize here is , If you switch to... Now 2.x Version , And the running webmaster is currently springboot The code in the series of Textbooks , Unexpected mistakes will occur , Finally, it creates obstacles to your study .
So the stationmaster shouted at the top of his voice 3 sentence : Do not modify the version number at will ! Do not modify the version number at will ! Do not modify the version number at will !
At present, the mainstream development tool is Eclipse and IDEA, So separate , The current knowledge points are Eclipse, The next knowledge point is IDEA.
Eclipse Provides a dedicated development SpringBoot The plug-in is called Spring Tool Suite. This plug-in is installed using foreign sources , Installation is too laggy , At least dozens of minutes .
and SpringBoot application , It's essentially a Java program , Its style is maven style , So it's another Maven project , Next, we'll follow maven Just create it as a project . Don't be overshadowed by fancy plug-ins .
 about STS plug-in unit
Step 5 :

Run... First , See the effect , Learn again

edit top fracture
The old rule , First download the runnable project in the upper right corner , Configure to run , After confirming availability , Then learn what steps have been taken to achieve this effect .
This is a maven project , Eclipse Import maven Project approach , Please refer to the following steps : stay Eclipse Import in maven project
Then run the class : com.how2java.springboot.Application Main method of
Then visit the address :

http://127.0.0.1:8080/hello

You can see the effect as shown in the figure .
notes : this maven The project uses a lot jar Bag , If not jar Package download slow , You can use the library I'm using : Used by the station master maven Warehouse , It's just a little big ~
 Run... First , See the effect , Learn again
Step 6 :

Imitation and troubleshooting

edit top fracture
After ensuring that the runnable project can run correctly , Then strictly follow the steps in the tutorial , Imitate the code again .
The imitation process inevitably has code differences , As a result, the expected operation results cannot be obtained , At this moment, by comparison The correct answer ( Runnable project ) And your own code , To locate the problem .
In this way , Learning is effective , Troubleshooting is efficient , It can obviously improve the learning speed , Across all the barriers on the way to learning .

It is recommended to use diffmerge Software , Compare folders . Put your own project folder , Compare with my runnable project folder .
This software is awesome , You can know which two files in the folder are wrong , And clearly marked
Here is a green installation and use tutorial : diffmerge Download and use tutorials
Run... First , See the effect , Learn again Successful students , It may be a little strange . It's a... that's clearly running web program , Why the startup mode is not startup tomcat? It's a start Java Class Main method ?
This is because of this com.how2java.springboot.Application The main method of the class puts tomcat Embedded , There is no need to start manually tomcat What happened .
Then start from 0 Start creating this project .
Create a new one first maven project
Menu -> File -> New -> Other -> Maven -> Maven -> Maven Project -> New Maven Project
Tick this Create a simple project (skip archetype selection), See ,Springboot It's a simple maven project

notes : Before creating the project , To put Run... First , See the effect , Learn again The program started in step returns first , Otherwise there will be problems .
 Create project
Then enter these values in the red box in the parameter
 Enter project parameters
Use the following pom.xml The contents of the project cover pom.xml.

After covering , Right click on the item ->Maven->Update Project Update the project .

this pom.xml It specifies the... Required for the current project jar Bag .
notes : this maven The project uses a lot jar Bag , If not jar Package download slow , You can use the library I'm using : Used by the station master maven Warehouse , It's just a little big ~
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.how2java</groupId> <artifactId>springboot</artifactId> <version>0.0.1-SNAPSHOT</version> <name>springboot</name> <description>springboot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <properties> <java.version>1.8</java.version> </properties> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
establish Application.java, Its annotation @SpringBootApplication It means that this is a SpringBoot application , Running its main method will start tomcat, The default port is 8080
package com.how2java.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
package com.how2java.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
Then create the controller class HelloController, This class is Spring MVC An ordinary controller in .
@RestController yes spring4 New notes in , yes @ResponseBody and @Controller Abbreviation for .
package com.how2java.springboot.web; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class HelloController { @RequestMapping("/hello") public String hello() { return "Hello Spring Boot!"; } }
package com.how2java.springboot.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String hello() {
        return "Hello Spring Boot!";
    }

}
Then run Application.java, Then visit the address

http://127.0.0.1:8080/hello

You can see the test results
 Run and test


The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .


Q & A area    
2021-07-24 Could not calculate build plan Problem solving
North by Northwest

Refer to this operation , Problem solved https://blog.csdn.net/qian1818/article/details/80391034







The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see




2020-11-03 Eclipse Go ahead Maven Environment configuration uses
Hitokui

Eclipse Go ahead Maven Environment configuration uses https://www.cnblogs.com/tangshengwei/p/6341462.html




1 One answer

qq2880668
Answer time :2021-03-05
and idea It's almost the same , find maven Installation path , find setting.xml File ( It has to be changed into Alibaba's remote warehouse , Or the original download is too slow ), Find library



The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see




2020-08-26 sts Plugin not found
2020-05-15 HelloController Remember to put it in Application Under the consent directory
2020-05-12 I don't know how to run ,,,, It's a choice maven build Are you


Too many questions , Page rendering is too slow , To speed up rendering , Only a few questions are displayed on this page at most . also 31 Previous questions , please Click to view

Please... Before asking questions land
The question has been submitted successfully , Auditing . Please My question Check the question record at , thank you
about JAVA Frame -SpringBoot- introduction -Eclipse Your questions

Try to provide Screenshot code and Abnormal information , Help to analyze and solve problems . You can also enter this station QQ Group communication : 496725845
Ask questions and try to provide complete code , Environment description , The more conducive to the recurrence of the problem , The faster your question can be answered .
Have questions about the code in the tutorial , Please provide which step , Which line is in doubt , This makes it easy to quickly locate the problem , Improve the speed at which questions are answered
In the thousands of questions that already exist , A considerable proportion , Because of the use of and webmaster Different versions of the development environment Resulting in , For example jdk, eclpise, idea, mysql,tomcat Wait, the version of the software is inconsistent .
Please use the same version as the webmaster , You can save yourself a lot of learning time . The webmaster sorted out the software versions used in teaching , It's all here , Convenient for everyone to download : /k/helloworld/helloworld-version/1718.html

Upload screenshot