org.springframework.boot
spring-boot-starter-freemarker
org.springframework.boot
spring-boot-devtools
true
org.springframework.boot
spring-boot-maven-plugin
true
3、创建SpringBoot启动程序
注意:springBoot必须放在Controller包的顶层
package com.jmxk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBoot_Start {
public static void main(String[] args) {
SpringApplication.run(SpringBoot_Start.class, args);
}
}
4、创建HTTP请求连接类
package com.jmxk.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//@RestController = @Conctroller + @ResponseBody
@RestController
public class HelloController {
@RequestMapping(“/helloIndex”)
public String HelloIndex() {
return “欢迎使用springBoot2.0!”;
}
}
5、启动SpringBoot程序
控制信息出现Spring图标样式并且程序一直在运行没报错则表示启动成功!
. ____ _ __ _ _
/\ / _’ __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ’ / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
’ || .__|| ||| |__, | / / / /
<