JAVA-SpringBoot二{SpringBoot程序}JAVA从基础开始 --10
SpringBoot程序
官网下载,或者idea创建
在Application 同级目录建包
自动装配
package com.example.demo.controliel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloControliel {
@RequestMapping("/hello")
public String Hello() {
return "Hello Word";
}
}
依赖
所有的Sp
ringBoot依赖都是用spring-boot-starter这个开头的
多层接口
package com.baokeaia.controllel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/hello")
public class HelloControliel {
@GetMapping("/get")
@ResponseBody // 应答器
public String Hello() {
return "getHeelo";
}
}
这里是配置文件
配置logo