Spring Boot 入门
MicroServices
微服务:架构风格(服务微化),一个应用应该是一组小型服务,可以通过HTTP的方式进行互通,每一个功能单元最最终都是一个可以独立替换和独立升级的软件单元;
HelloWord
1 24 4.0.0 5 6com.ahabest.springboot 7HelloWord 80.0.1-SNAPSHOT 9HelloWord 10HelloWord 11 1213 15 16 171.8 1418 23org.springframework.boot 19spring-boot-starter-parent 202.1.6.RELEASE 2122 24 25 26 38 3927 30 31org.springframework.boot 28spring-boot-starter-web 2932 36 37org.springframework.boot 33spring-boot-starter-test 34test 3540 4741 4642 45org.springframework.boot 43spring-boot-maven-plugin 44
1 package com.ahabest.springboot.controller; 2 import org.springframework.stereotype.Controller; 3 import org.springframework.web.bind.annotation.RequestMapping; 4 import org.springframework.web.bind.annotation.ResponseBody; 5 @Controller 6 public class HelloWord { 7 @ResponseBody 8 @RequestMapping("/hello") 9 public String hello() {10 return "Hello Word!";11 }12 }
1 package com.ahabest.springboot;2 import org.springframework.boot.SpringApplication;3 import org.springframework.boot.autoconfigure.SpringBootApplication;4 @SpringBootApplication5 public class HelloWordApplication {6 public static void main(String[] args) {7 SpringApplication.run(HelloWordApplication.class, args);8 }9 }