當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
使用IDEA 创建SpringBoot项目
生活随笔
收集整理的這篇文章主要介紹了
使用IDEA 创建SpringBoot项目
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先File ->New -> project ->Spring Initializr ->next
如果沒有Spring Initializr ? 選擇右下角config ->setting ?搜索Springboot 勾選 ?然后apply ok
?
第二步:
在項目中寫上自己需要的名稱 type 選擇 maven project ->next
?
第三步:
?
?選擇sql
?
nosql 然后一路next? finsh 結束
?
?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><groupId>com.cedar.star</groupId><artifactId>demo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>scm</name><description>scm project for Spring Boot</description><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.4.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-batch</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-quartz</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>1.3.2</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.batch</groupId><artifactId>spring-batch-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>?
?寫一個測試demo 看看效果:
配置端口:
?
package com.cedar.demo;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;@RestController @SpringBootApplication public class index {@RequestMapping("/")String index() {return "Hello Spring Boot";}public static void main(String[] args) {SpringApplication.run(index.class, args);} }
啟動項目
結果:
?
轉載于:https://www.cnblogs.com/xiaosisong/p/9507041.html
總結
以上是生活随笔為你收集整理的使用IDEA 创建SpringBoot项目的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java泛型详解:<T>和Class<T
- 下一篇: 编程式事务和声明式事物