星空网 > 软件开发 > Java

springboot 学习 2

创建springboot的Maven模块。

对于Maven管理的项目,还是习惯于多模块。将项目结构做下调整。

1。修改springboot项目的pom文件。

 1 <??> 2 <project ="http://maven.apache.org/POM/4.0.0" ="http://www.w3.org/2001/ 3   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4   <modelVersion>4.0.0</modelVersion> 5  6   <groupId>com.taynio.demo</groupId> 7   <artifactId>springboot</artifactId> 8   <version>0.0.1-SNAPSHOT</version> 9   <packaging>pom</packaging>10 11   <name>springboot</name>12   <description>Demo project for Spring Boot</description>13 14   <parent>15     <groupId>org.springframework.boot</groupId>16     <artifactId>spring-boot-starter-parent</artifactId>17     <version>1.3.3.RELEASE</version>18     <relativePath/> <!-- lookup parent from repository -->19   </parent>20 21   <properties>22     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>23     <java.version>1.8</java.version>24   </properties>25 26   <build>27     <plugins>28       <plugin>29         <groupId>org.springframework.boot</groupId>30         <artifactId>spring-boot-maven-plugin</artifactId>31       </plugin>32     </plugins>33   </build>34 35 </project>

将springboot项目作为顶级项目。在此基础上,新建Maven模块项目web-rest模块。

IntelliJ IDEA会自动给我们springboot 项目的pom.

    <modules>
        <module>web-rest</module>
    </modules>

2。修改web-rest项目的pom.

 1 <??> 2 <project ="http://maven.apache.org/POM/4.0.0" 3      ="http://www.w3.org/2001/ 4      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 5   <modelVersion>4.0.0</modelVersion> 6  7   <parent> 8     <artifactId>springboot</artifactId> 9     <groupId>com.taynio.demo</groupId>10     <version>0.0.1-SNAPSHOT</version>11   </parent>12   <artifactId>web-rest</artifactId>13   <packaging>jar</packaging>14 15   <dependencies>16     <dependency>17       <groupId>org.springframework.boot</groupId>18       <artifactId>spring-boot-starter-web</artifactId>19     </dependency>20 21     <dependency>22       <groupId>org.springframework.boot</groupId>23       <artifactId>spring-boot-starter-test</artifactId>24       <scope>test</scope>25     </dependency>26   </dependencies>27 28   <build>29     <plugins>30       <plugin>31         <groupId>org.springframework.boot</groupId>32         <artifactId>spring-boot-maven-plugin</artifactId>33       </plugin>34     </plugins>35   </build>36 37 </project>

3。建立SpringBoot的启动程序。

新建Java类:com.taynio.demo.springboot.SpringbootWebRestApplication:

 1 package com.taynio.demo.springboot; 2  3 import org.springframework.boot.SpringApplication; 4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5  6 /** 7  * Created by Zhantao on 2016/3/24. 8  * Date:2016/3/24 15:28 9  * Email:10 */11 @SpringBootApplication12 public class SpringbootWebRestApplication {13 14   public static void main(String[] args) {15     SpringApplication.run(SpringbootWebRestApplication.class, args);16   }17 18 }

 

 

运行。web-rest项目模块创建成功。

 




原标题:springboot 学习 2

关键词:Spring

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

选品流程分解:https://www.goluckyvip.com/tag/7266.html
开在境外开户:https://www.goluckyvip.com/tag/72660.html
免费国外网络账户开户多少钱:https://www.goluckyvip.com/tag/72668.html
海外抖音开户:https://www.goluckyvip.com/tag/72669.html
谷歌收购模式:https://www.goluckyvip.com/tag/7267.html
美原油国内开户:https://www.goluckyvip.com/tag/72671.html
外贸英语函电词汇汇总 | 外贸英语+商务英语:https://www.kjdsnews.com/a/1836327.html
你的网站应该屏蔽AI Bot吗?:https://www.kjdsnews.com/a/1836328.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流