mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 06:03:52 +08:00
Spring Boot 入门、Spring Boot 配置、Web 开发、模板引擎、数据存储、数据缓存 案例更新
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 核心技术实战 - 上 基础篇》!";
|
||||
}
|
||||
}
|
||||
@@ -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 "Hello,Spring Boot!";
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user