1简介
SpringBoot用了也有那么久,刚好最近也有时间,就写个系列总结
2.helloWorld 搭建
Eclipse-file-new maven project-
quickstart选择
新建controller
package com.jf.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description
* @Author
* @Date 2018年7月30日
*/
@RestController
public class HelloSpringBootController {
@RequestMapping("/hello")
public String hello(){
return "hello SpringBoot";
}
}
package com.jf.mavenLogin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* Hello world!
*
*/
@ComponentScan(basePackages = "com.jf.controller")
@EnableAutoConfiguration
public class App
{
public static void main( String[] args )
{
SpringApplication.run(App.class, args);
}
}
run as javaApplication
pom.xml
<!-- 定义SpringBoot的版本 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent>
<!-- SpringBoot web组件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
pastMan测试