Spring Boot 入门、Spring Boot 配置、Web 开发、模板引擎、数据存储、数据缓存 案例更新

This commit is contained in:
liqiangqiang
2018-04-08 14:46:30 +08:00
parent c862ecd73b
commit fc5200546c
70 changed files with 2201 additions and 293 deletions

View File

@@ -0,0 +1,16 @@
package demo.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring Boot 应用启动类
*
* Created by bysocket on 26/09/2017.
*/
@SpringBootApplication
public class QuickStartApplication {
public static void main(String[] args) {
SpringApplication.run(QuickStartApplication.class, args);
}
}

View File

@@ -0,0 +1,19 @@
package demo.springboot.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* Spring Boot Hello案例
*
* Created by bysocket on 26/09/2017.
*/
@RestController
public class HelloBookController {
@RequestMapping(value = "/book/hello",method = RequestMethod.GET)
public String sayHello() {
return "Hello《Spring Boot 2.x 核心技术实战 - 上 基础篇》!";
}
}

View File

@@ -0,0 +1,21 @@
package demo.springboot.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Spring Boot Hello案例
*
* Created by bysocket on 26/09/2017.
*/
@Controller
public class HelloController {
@RequestMapping(value = "/hello",method = RequestMethod.GET)
@ResponseBody
public String sayHello() {
return "HelloSpring Boot";
}
}

View File

@@ -0,0 +1,16 @@
package demo.springboot;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class QuickStartApplicationTests {
@Test
public void contextLoads() {
}
}