亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

SpringBoot?分模塊開發(fā)的操作方法

 更新時(shí)間:2022年04月02日 09:55:05   作者:好大一只雞  
這篇文章主要介紹了SpringBoot?分模塊開發(fā)的操作方法,通過在原項(xiàng)目新增一個(gè)maven模塊,本文通過示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

1、在原項(xiàng)目新增一個(gè)maven模塊

選 maven ,不要選 spring initializr不然會(huì)覆蓋掉原項(xiàng)目

2、新增的maven模塊會(huì)出現(xiàn)在項(xiàng)目中,選配置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">
    <parent>                             //各個(gè)子項(xiàng)目,需要添加對(duì)parent 的依賴
        <artifactId>ruoyi</artifactId>   //parent項(xiàng)目中不存放任何代碼,只是管理多個(gè)項(xiàng)目之間公共的依賴,即項(xiàng)目最外部的那個(gè)POM
        <groupId>com.ruoyi</groupId>
        <version>3.8.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
 
    <artifactId>stone</artifactId>  //模塊名稱
    <dependencies>
        <!-- 通用工具-->   //引用其它模塊或組件,開發(fā)時(shí)用的到
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common</artifactId>
        </dependency>
    </dependencies>
</project>

 3、在父項(xiàng)目POM中加上新增模塊的配置

           <!-- 通用工具-->
            <dependency>
                <groupId>com.ruoyi</groupId>
                <artifactId>ruoyi-common</artifactId>
                <version>${ruoyi.version}</version>
            </dependency>
 
            <!-- stone-->  //這里添加新增的模塊
                <artifactId>stone</artifactId>
        </dependencies>
    </dependencyManagement>
    <modules>
        <module>ruoyi-admin</module>
        <module>ruoyi-framework</module>
        <module>ruoyi-system</module>
        <module>ruoyi-quartz</module>
        <module>ruoyi-generator</module>
        <module>ruoyi-common</module>
        <module>stone</module>  //這里注明引入的是模塊
    </modules>

4、在主啟動(dòng)模塊中引用模塊

        <!-- 代碼生成-->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-generator</artifactId>
        </dependency>
        <!-- stone-->  //主啟動(dòng)模塊這里也加上去
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>stone</artifactId>
            <version>3.8.1</version>
        </dependency>
    </dependencies>

 5、在主模塊中配置SpringBoot的包掃描,使Controller可以用起來

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@ComponentScan(basePackages = {"com.ruoyi.*","com.ruoyi.stone.*"})  //這里需加入包掃描,否則啟用不了新增模塊里面的控制器等方法
public class RuoYiApplication
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);

到此這篇關(guān)于SpringBoot 分模塊開發(fā)的文章就介紹到這了,更多相關(guān)SpringBoot 分模塊開發(fā)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論