Intellij Idea新建SpringBoot項(xiàng)目方式
更新時(shí)間:2024年09月07日 09:44:43 作者:LI_AINY
這篇文章主要介紹了Intellij Idea新建SpringBoot項(xiàng)目方式,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
Intellij Idea新建SpringBoot項(xiàng)目
1.新建project
2.選擇
3.起名字
4.勾選web
5.選擇目錄 、名字 finsh
6.在pom.xml中添加依賴
<?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> <!-- 這個(gè)標(biāo)簽是在配置 Spring Boot 的父級依賴 有了這個(gè),當(dāng)前的項(xiàng)目才是 Spring Boot 項(xiàng)目,spring-boot-starter-parent 是一個(gè)特殊的 starter , 它用來提供相關(guān)的 Maven 默認(rèn)依賴,使用它之后,常用的包依賴就可以省去 version 標(biāo)簽。 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.ljw</groupId> <artifactId>test</artifactId> <version>0.0.1-SNAPSHOT</version> <name>test</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <!--Spring Boot 提供了熱部署的方式,當(dāng)發(fā)現(xiàn)任何類發(fā)生了改變,就會通過 JVM 類加載的方式,加載最新的類到虛擬機(jī)中--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <!-- 這個(gè)需要為 true 熱部署才有效 --> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
7.新建一個(gè)helloWorld類
package com.ljw.test; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @RestController 注解: 該注解是 @Controller 和 @ResponseBody 注解的合體版 */ @RestController public class HelloWorld { /** * 測試類 */ @RequestMapping("/hello") public String hello() { return "Hello Spring Boot!My First Page"; } }
8.啟動自動生成的TestApplication類
9.訪問網(wǎng)址
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Spring Boot異步調(diào)用@Async過程詳解
這篇文章主要介紹了Spring Boot異步調(diào)用@Async過程詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11利用javaFX實(shí)現(xiàn)移動一個(gè)小球的示例代碼
這篇文章主要介紹了利用javaFX實(shí)現(xiàn)移動一個(gè)小球的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09Spring AOP之@Around,@AfterReturning使用、切不進(jìn)去的解決方案
這篇文章主要介紹了Spring AOP之@Around,@AfterReturning使用、切不進(jìn)去的解決方案,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-05-05Spring @Scheduler使用cron表達(dá)式時(shí)的執(zhí)行問題詳解
Spring給程序猿們帶來了許多便利。下面這篇文章主要給大家介紹了關(guān)于Spring @Scheduler使用cron表達(dá)式時(shí)的執(zhí)行問題的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-09-09Java實(shí)現(xiàn)任意進(jìn)制轉(zhuǎn)換
這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)任意進(jìn)制轉(zhuǎn)換的方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-08-08