快速搭建spring-boot的HelloWord项目
2017-09-21 00:00
585 查看
搭建一个SpringBoot的HelloWold工程
新建一个maven工程<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.3.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>1.2.3.RELEASE</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/libs-snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> <url>http://repo.spring.io/snapshot</url> </pluginRepository> <pluginRepository> <id>spring-milestones</id> <url>http://repo.spring.io/milestone</url> </pluginRepository> </pluginRepositories>
入口application类
@SpringBootApplication public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class,args); } }
Controller类
@RestController @EnableAutoConfiguration @RequestMapping("/home") public class SearchController { @RequestMapping(value = {"/index"},method = RequestMethod.GET) @ResponseBody public Object index(){ List<String> result = new ArrayList<String>(); result.add("Hello Wold"); return result; } }
结果
相关文章推荐
- start.spring.io快速搭建springboot项目页面解析介绍
- 快速搭建SpringBoot项目
- Spring Boot -- RESTFul API 简单项目的快速搭建
- 004-Spring boot 快速入门-项目搭建与启动、SpringBootApplication
- 构建微服务:快速搭建Spring Boot项目
- IDEA 快速搭建springboot项目,返回HTML首页
- 【SpringBoot探索一】SpringBoot快速搭建基础web项目
- SpringBoot1-spirng项目快速搭建+maven+spring的基本配置
- spring-boot(2) - RESTfull API简单项目的快速搭建
- springboot (1) 快速搭建简单项目
- Spring Boot 学习(一) 快速搭建SpringBoot 项目
- Spring-Boot快速搭建web项目详细总结
- SpringBoot(一)_快速实战搭建项目
- SpringBoot学习:IDEA中快速搭建springboot项目
- Spring Boot 初探[1]--快速搭建Spring Boot项目
- 教你十分钟快速搭建springBoot项目实战
- 快速搭建Spring Boot项目
- [置顶] WEB开发----Spring Boot项目快速搭建
- springBoot快速搭建项目
- 003,spring boot RESTfull API简单项目的快速搭建