SpringBoot首个配置示例如何编写?

更新于
2026-10-12 10:50:52
1阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计213个文字,预计阅读时间需要1分钟。

SpringBoot首个配置示例如何编写?

xml 4.0.0 com.luo.demo demo 1.0-SNAPSHOT jar org.springframework.boot spring-boot-starter-parent 1.5.6.RELEASE UTF-8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-maven-plugin Application.java @SpringBootApplication

SpringBoot首个配置示例如何编写?

pom.xml

4.0.0 com.luo.demo demo 1.0-SNAPSHOT

jar

org.springframework.boot spring-boot-starter-parent 1.5.6.RELEASE

UTF-8 org.springframework.boot spring-boot-starter-web

org.springframework.boot spring-boot-maven-plugin Application.java

@SpringBootApplication public class Application { public static void main(String[] args) throws InterruptedException { SpringApplication.run(Application.class, args); } } IndexController.java

@RestController @RequestMapping("/") public class IndexController { @GetMapping("/") public String index() { return "hello world"; } @GetMapping("/hello/{msg}") public String hello(@PathVariable("msg") String msg) { return "hello " + msg; } }

本文共计213个文字,预计阅读时间需要1分钟。

SpringBoot首个配置示例如何编写?

xml 4.0.0 com.luo.demo demo 1.0-SNAPSHOT jar org.springframework.boot spring-boot-starter-parent 1.5.6.RELEASE UTF-8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-maven-plugin Application.java @SpringBootApplication

SpringBoot首个配置示例如何编写?

pom.xml

4.0.0 com.luo.demo demo 1.0-SNAPSHOT

jar

org.springframework.boot spring-boot-starter-parent 1.5.6.RELEASE

UTF-8 org.springframework.boot spring-boot-starter-web

org.springframework.boot spring-boot-maven-plugin Application.java

@SpringBootApplication public class Application { public static void main(String[] args) throws InterruptedException { SpringApplication.run(Application.class, args); } } IndexController.java

@RestController @RequestMapping("/") public class IndexController { @GetMapping("/") public String index() { return "hello world"; } @GetMapping("/hello/{msg}") public String hello(@PathVariable("msg") String msg) { return "hello " + msg; } }