使用eclipse快速新建spirngboot項(xiàng)目的方法
分享兩種eclipse創(chuàng)建spirngboot項(xiàng)目的辦法:
方案一:創(chuàng)建maven項(xiàng)目后修改pom文件
1.用eclipse創(chuàng)建簡(jiǎn)單的maven項(xiàng)目
2.修改pom文件
<?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.新建一個(gè)類文件
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); } }
說(shuō)明:
1.spring-boot-starter-parent:
springboot官方推薦的maven管理工具,最簡(jiǎn)單的做法就是繼承它。 spring-boot-starter-parent包含了以下信息:
- 缺省使用java6編譯, 如果需要改為java 1.7,則在pom中加上java.version屬性即可
- 使用utf-8編碼
- 實(shí)現(xiàn)了通用的測(cè)試框架 (JUnit, Hamcrest, Mockito).
- 智能資源過(guò)濾
- 智能的插件配置(exec plugin, surefire, Git commit ID, shade).
2.spring-boot-starter-web
springboot內(nèi)嵌的WEB容器, 缺省會(huì)使用tomcat
方案二:在eclipse上安裝STS插件
1、Help -> Eclipse Marketplace
Search或選擇“Popular”標(biāo)簽,選擇Spring Tool Suite (STS) for Eclipse插件,安裝 或者谷歌百度搜索
2、new project -> 輸入spring 下面會(huì)有提示 選擇Spring Starter Project
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
IDEA創(chuàng)建MyBatis配置文件模板的方法步驟
這篇文章主要介紹了IDEA創(chuàng)建MyBatis配置文件模板的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04SpringBoot預(yù)防XSS攻擊的實(shí)現(xiàn)
XSS攻擊是一種在web應(yīng)用中的計(jì)算機(jī)安全漏洞,它允許惡意web用戶將代碼植入到提供給其它用戶使用的頁(yè)面,本文主要介紹了SpringBoot預(yù)防XSS攻擊的實(shí)現(xiàn),感興趣的可以了解一下2023-08-08SpringSecurity OAuth2單點(diǎn)登錄和登出的實(shí)現(xiàn)
本文主要介紹了SpringSecurity OAuth2單點(diǎn)登錄和登出的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02MYSQL批量插入數(shù)據(jù)的實(shí)現(xiàn)代碼
非常的實(shí)現(xiàn)原理,代碼較多,建議大家仔細(xì)看看。2008-10-10Java中String.format的使用方法總結(jié)
這篇文章主要介紹了Java中String.format的用法總結(jié)的相關(guān)資料,需要的朋友可以參考下2017-03-03Java實(shí)現(xiàn)辦公文檔在線預(yù)覽功能
java實(shí)現(xiàn)辦公文件在線預(yù)覽功能是一個(gè)大家在工作中也許會(huì)遇到的需求,這篇文章就教大家如何實(shí)現(xiàn)這一功能,感興趣的小伙伴可以了解一下2021-12-12java基于遞歸算法實(shí)現(xiàn)漢諾塔問(wèn)題實(shí)例
這篇文章主要介紹了java基于遞歸算法實(shí)現(xiàn)漢諾塔問(wèn)題,結(jié)合具體實(shí)例形式分析了java遞歸算法的實(shí)現(xiàn)與使用技巧,需要的朋友可以參考下2017-07-07