标签:分享图片 autoconf end tap get pack 数据 配置 ica
1. 去https://start.spring.io/默认下载一个maven项目 Generate Project(懂的话也可以更改其中的配置)。
2. 打开Eclipse,导入刚刚解压的Maven项目。
3. 在demo下建立一个controller包,简单显示一点数据:
package com.example.demo.controller;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
@RequestMapping("/springboot")
public class HelloController {
@RequestMapping("/hello")
public String hello() {
return "Hello Spring Boot";
}
}
注意:maven包下还需要引入以下dependency:
<!-- 引入@RestController和@RequestMapping --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
然后Java Application运行DemoApplication,浏览器输入localhost:8080/springboot/hello即可看到

,这样就搭建好了。
用Eclipse+Maven快速创建一个SpringBoot项目
标签:分享图片 autoconf end tap get pack 数据 配置 ica
原文地址:https://www.cnblogs.com/clack/p/10109140.html