分享两种eclipse创建spirngboot项目的办法:
方案一:创建maven项目后修改pom文件
1.用eclipse创建简单的maven项目
2.修改pom文件
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.chry</groupId>
<artifactId>studySpringBoot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.7</java.version>
</properties>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- Package as an executable jar -->
<build>
<finalName>studySpringBoot</finalName>
</build>
</project>
|
3.新建一个类文件
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package com.chry.study;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@EnableAutoConfiguration
public class SampleController {
@RequestMapping("/")
@ResponseBody
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}
|
说明:
1.spring-boot-starter-parent:
springboot官方推荐的maven管理工具,最简单的做法就是继承它。 spring-boot-starter-parent包含了以下信息:
- 缺省使用java6编译, 如果需要改为java 1.7,则在pom中加上java.version属性即可
- 使用utf-8编码
- 实现了通用的测试框架 (JUnit, Hamcrest, Mockito).
- 智能资源过滤
- 智能的插件配置(exec plugin, surefire, Git commit ID, shade).
2.spring-boot-starter-web
springboot内嵌的WEB容器, 缺省会使用tomcat
方案二:在eclipse上安装STS插件
1、Help -> Eclipse Marketplace
Search或选择“Popular”标签,选择Spring Tool Suite (STS) for Eclipse插件,安装 或者谷歌百度搜索
2、new project -> 输入spring 下面会有提示 选择Spring Starter Project
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持快网idc。
原文链接:http://www.jianshu.com/p/4d151fb696ea#
相关文章
猜你喜欢
- ASP.NET本地开发时常见的配置错误及解决方法? 2025-06-10
- ASP.NET自助建站系统的数据库备份与恢复操作指南 2025-06-10
- 个人网站服务器域名解析设置指南:从购买到绑定全流程 2025-06-10
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-27 61
-
2025-05-27 50
-
2025-05-29 26
-
2025-05-27 53
-
详解Spring Cloud中Hystrix 线程隔离导致ThreadLocal数据丢失
2025-05-29 60
热门评论

