欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn)

 更新時(shí)間:2024年05月24日 11:59:24   作者:小Aan《啊中》  
本文主要介紹了Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

基于Spring Boot、Spring Cloud、Spring Cloud Alibaba的微服務(wù)開發(fā),組件眾多。因此,在創(chuàng)建項(xiàng)目伊始,就應(yīng)當(dāng)考慮版本的管理。以Spring Boot的版本升級發(fā)布為基礎(chǔ),Spring Cloud的版本升級發(fā)布,會匹配Spring Boot升級發(fā)布的版本。Spring Cloud Alibaba版本升級發(fā)布,會匹配Spring Boot和Spring Cloud的版本升級發(fā)布的版本

本例版本:

Spring Boot 2.6.3
Spring Cloud 2021.0.1
Spring Cloud Alibaba 2021.0.1.0
Apache Maven 3.6.3
IntelliJ IDEA 2021.2.3
JDK 1.8
Spring Framework 5.3.15

本例實(shí)現(xiàn)基于Maven和IntelliJ IDEA搭建多模塊微服務(wù)項(xiàng)目(工程)。

第一層級工程,只管理第二層級工程。

第二層級工程,管理第三層級工程。

以此類推,使用pom.xml中的modules和module標(biāo)簽管理維護(hù)關(guān)系。

1.規(guī)劃微服務(wù)

規(guī)劃微服務(wù)如表格。

2.創(chuàng)建hub-example

hub-example,是頂級工程,是一個(gè)聚合工程,用來管理工程所有模塊。在hub-example中的src目錄不寫代碼,可以刪除。在pom.xml中打包方式配置為pom。

2.1 創(chuàng)建Maven工程

運(yùn)行IDEA,依次選擇菜單File->New->Project進(jìn)入New Project對話框,如下配置。

2.2 配置工程信息

hub-example工程配置信息。

2.3 創(chuàng)建完成

項(xiàng)目創(chuàng)建完成如圖,項(xiàng)目初始列表,pom.xml初始化文件

3.配置hub-example的pom.xml

配置hub-example的pom.xml,包括以下幾點(diǎn)內(nèi)容,細(xì)節(jié)在pom.xml查看。

(1)配置打包方式。

(2)配置核心依賴。

(3)配置版本管理。

(4)配置打包插件。

(5)配置yml文件讀取pom文件的標(biāo)簽值。

<?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.hub</groupId>
    <artifactId>hub-example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>hub-dependencies</module>
        <module>hub-common</module>
        <module>hub-ware</module>
    </modules>

    <!--(1)配置打包方式(2)配置核心依賴(3)配置版本管理(4)配置打包插件(5)配置yml文件讀取pom文件的標(biāo)簽值。-->

    <!--聚合工程,打包方式:pom-->
        <packaging>pom</packaging>
        <!-- 版本管理 -->
        <properties>
            <maven.compiler.source>8</maven.compiler.source>
            <maven.compiler.target>8</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <java.version>1.8</java.version>
            <spring.boot.version>2.6.3</spring.boot.version>
            <spring.cloud.version>2021.0.1</spring.cloud.version>
            <spring.cloud.alibaba.version>2021.0.1.0</spring.cloud.alibaba.version>
            <!-- 統(tǒng)一管理hub-example的版本,在子模塊直接使用此版本即可-->
            <hub.example.version>1.0-SNAPSHOT</hub.example.version>
            <spring.boot.maven.plugin.version>2.6.3</spring.boot.maven.plugin.version>
            <mysql.version>5.1.47</mysql.version>
            <druid.version>1.1.23</druid.version>
            <pagehelper.version>1.4.1</pagehelper.version>
            <mybatis.version>2.2.0</mybatis.version>
            <mybatis-plus.version>3.3.1</mybatis-plus.version>
            <lombok.version>1.18.18</lombok.version>
            <fastjson.version>1.2.83</fastjson.version>
            <hutool.version>5.7.22</hutool.version>
            <commons.lang3.version>3.12.0</commons.lang3.version>
            <commons.io.version>2.11.0</commons.io.version>
        </properties>
        <!-- 核心依賴   -->
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-dependencies</artifactId>
                    <version>${spring.boot.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring.cloud.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <dependency>
                    <groupId>com.alibaba.cloud</groupId>
                    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                    <version>${spring.cloud.alibaba.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
        <build>
            <!-- yml文件讀取pom文件的標(biāo)簽值 -->
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <!-- 配置打包插件 -->
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring.boot.maven.plugin.version}</version>
                    <configuration>
                        <fork>true</fork>
                        <addResources>true</addResources>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <profiles>
            <profile>
                <!-- yml配置文件環(huán)境切換: dev/test/prod -->
                <id>env</id>
                <properties>
                    <profiles.active>dev</profiles.active>
                </properties>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
            </profile>
        </profiles>

</project>

4.hub-example添加模塊

hub-example添加的模塊也是聚合工程,主要包括:

(1)hub-dependencies,集中管理依賴。聚合工程,不寫代碼,可以刪除src目錄。其子模塊作用,在pom.xml文件引入常用的依賴。項(xiàng)目中其它工程只要引用hub-dependencies的子模塊就行。

(2)hub-common,管理封裝的通用模塊。聚合工程,不寫代碼,可以刪除src目錄。封裝的通用代碼放在這個(gè)模塊的子模塊中,給每個(gè)需要的工程引用。減少重復(fù)代碼,提供代碼可復(fù)用度。

(3)hub-ware,管理獨(dú)立運(yùn)行的微服。每個(gè)業(yè)務(wù)規(guī)劃一個(gè)微服務(wù)。

以hub-dependencies添加子模塊為例,歸納以下步驟。

4.1 新建Module

選中hub-example,右鍵,依次選擇:New->Module,進(jìn)入模塊配置對話框。

4.2 配置Module版本和方式

選擇Maven方式、選擇JDK版本。

4.3 配置Module基礎(chǔ)信息

配置hub-dependencies基礎(chǔ)信息。

4.4 添加剩余模塊

按照以上步驟,添加完成hub-common、hub-ware。

4.5 hub-example的pom.xml文件

hub-example的pom.xml文件中新增了<modules>標(biāo)簽即如下。即hub-example管理以下包含的模塊。

    <modules>
        <module>hub-dependencies</module>
        <module>hub-common</module>
        <module>hub-ware</module>
    </modules>

5.hub-dependencies添加模塊

hub-dependencies添加hub-pf-a-dependencies和hub-pf-b-dependencies模塊。

5.1 新建Module

選中hub-dependencies,右鍵,依次選擇:New->Module,進(jìn)入模塊配置對話框。

5.2 配置Module版本和方式

選擇Maven方式、選擇JDK版本。

5.3 配置Module基礎(chǔ)信息

配置hub-pf-a-dependencies基礎(chǔ)信息。

5.4 添加剩余模塊

按照以上步驟,添加完成hub-pf-b-dependencies。

5.5 hub-dependencies工程的pom.xml

添加模塊后,hub-dependencies工程的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">
    <parent>
        <artifactId>hub-example</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>hub-dependencies</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>hub-pf-a-dependencies</module>
        <module>hub-pf-b-dependencies</module>
    </modules>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

6.hub-common添加模塊

根據(jù)5.hub-dependencies添加模塊的步驟:

給hub-common添加example-common-entity和example-common-utils模塊。

6.1 hub-common工程的pom.xml

添加模塊后,hub-common工程的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">
    <parent>
        <artifactId>hub-example</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>hub-common</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>example-common-entity</module>
        <module>example-common-utils</module>
    </modules>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

7.hub-ware添加模塊

根據(jù)5.hub-dependencies添加模塊的步驟:

給hub-ware添加example-biz-a和example-biz-b模塊。

7.1 hub-ware工程的pom.xml

添加模塊后,hub-ware工程的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">
    <parent>
        <artifactId>hub-example</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>hub-ware</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>example-biz-a</module>
        <module>example-biz-b</module>
    </modules>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
    
</project>

8.hub-example工程列表

創(chuàng)建工程和添加子模塊后,工程hub-example工程列表。每個(gè)工程上一級和下一級都是通過pom.xml來維護(hù)管理關(guān)系。

9.hub-dependencies的子模塊添加依賴

為hub-dependencies模塊的子模塊hub-pf-a-dependencies和hub-pf-b-dependencies模塊添加依賴。

9.1 hub-pf-a-dependencies依賴

hub-pf-a-dependencies依賴,主要是基礎(chǔ)Jar包。

<?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>
        <artifactId>hub-dependencies</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>hub-pf-a-dependencies</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

        <dependencies>
            <!--基礎(chǔ)工具-->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${fastjson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons.lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons.io.version}</version>
            </dependency>
            <dependency>
                <groupId>cn.hutool</groupId>
                <artifactId>hutool-all</artifactId>
                <version>${hutool.version}</version>
            </dependency>
        </dependencies>

</project>

9.2 hub-pf-b-dependencies依賴

hub-pf-a-dependencies依賴,主要是操作數(shù)據(jù)庫的Jar包。

<?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>
        <artifactId>hub-dependencies</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>hub-pf-b-dependencies</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <!--數(shù)據(jù)庫操作-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
        <!--連接池-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>${druid.version}</version>
        </dependency>

        <!--PageHelper分頁插件-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>${pagehelper.version}</version>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${mybatis-plus.version}</version>
        </dependency>
    </dependencies>

</project>

10.hub-common的子模塊添加依賴

為hub-common模塊的子模塊example-common-entity和example-common-utils模塊添加依賴。

<?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>
        <artifactId>hub-common</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>example-common-utils</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

        <dependencies>
            <dependency>
                <groupId>com.hub</groupId>
                <artifactId>hub-pf-a-dependencies</artifactId>
                <version>${hub.example.version}</version>
            </dependency>
        </dependencies>

</project>

11.hub-ware添加依賴

為hub-ware模塊的子模塊example-biz-a模塊添加依賴。

11.1 example-biz-a依賴

example-biz-a需求:基礎(chǔ)依賴、數(shù)據(jù)庫操作依賴、springboot依賴。

注意:spring-boot、spring-cloud、spring-cloud-alibaba,在hub-example中已經(jīng)引入頂級依賴。在子工程中使用其模塊,可以不需要加版本號。

<?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>
        <artifactId>hub-ware</artifactId>
        <groupId>com.hub</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>example-biz-a</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

        <dependencies>

            <!--springboot依賴-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

            <!--基礎(chǔ)依賴-->
            <dependency>
                <groupId>com.hub</groupId>
                <artifactId>hub-pf-a-dependencies</artifactId>
                <version>${hub.example.version}</version>
            </dependency>

            <!--數(shù)據(jù)庫操作依賴-->
            <dependency>
                <groupId>com.hub</groupId>
                <artifactId>hub-pf-b-dependencies</artifactId>
                <version>${hub.example.version}</version>
            </dependency>
        </dependencies>

    <!--example-biz-a打包成可執(zhí)行Jar包-->
    <packaging>jar</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.maven.plugin.version}</version>
                <configuration>
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
                <executions>
                    <execution>
                        <!-- 把依賴包打包到可執(zhí)行的jar包中-->
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

11.2 example-biz-a打包成可執(zhí)行Jar包

example-biz-a打包成可執(zhí)行Jar包,則在pom.xml中添加配置。

<packaging>jar</packaging>
<build>
 <plugins>
   <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring.boot.maven.plugin.version}</version>
    <configuration>
        <fork>true</fork>
        <addResources>true</addResources>
    </configuration>
    <executions>
      <execution>
          <!-- 把依賴包打包到可執(zhí)行的jar包中-->
          <goals>
              <goal>repackage</goal>
          </goals>
      </execution>
    </executions>
   </plugin>
 </plugins>
</build>

12.1在example-biz-a模塊中創(chuàng)建一個(gè)包c(diǎn)om.htb,并在該包下創(chuàng)建一個(gè)啟動類BizAApplication

啟動類代碼如下:

package com.hub;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class BizAApplication {
    public static void main(String[] args) {
        SpringApplication.run(BizAApplication.class, args);
        System.out.println("BizAApplication模塊啟動成功!!");
    }
}

12.2在resources包下創(chuàng)建application.yml配置數(shù)據(jù)庫連接池和分頁插件參數(shù),代碼如下:

# tomcat端口號
server:
  port: 8080
# spring配置
spring:
  application:
    # 程序名
    name: example-biz-a
  # 數(shù)據(jù)源配置
  datasource:
    druid:
      username: root
      password: root
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# 配置mybatis
mybatis:
  configuration:
    # 將下劃線映射成駝峰命名
    map-underscore-to-camel-case: true
    # 指定日志的實(shí)現(xiàn)類,在控制臺顯示SQL語句
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  # 給實(shí)體類指定別名,在resultType中不用指定類全名,使用類簡單名字即可 (多個(gè)包使用逗號分隔)
  #type-aliases-package: com.itheima.reggie.entity,com.itheima.reggie.dto
  # 指定映射文件目錄 mybatis中實(shí)體映射文件xml所在的目錄
  mapper-locations: classpath:mapper/*.xml
# 分頁組件
pagehelper:
  # 合理化分頁,如果為true,pageNum < 1 會查詢第1頁 pageNum > 最后一頁 會查詢最后一頁的數(shù)據(jù)
  # 如果設(shè)置為false,pageNum < 1 或 pageNum > 最后一頁 會返回空的數(shù)據(jù)
  reasonable: true
  # 指定使用哪種數(shù)據(jù)庫
  helper-dialect: mysql

12.3開啟動類BizAApplication,spring和pagehelper分頁組件啟動成功??!

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.3)

2024-02-25 11:49:31.216  INFO 12620 --- [           main] com.hub.BizAApplication                  : Starting BizAApplication using Java 1.8.0_221 on LAPTOP-MN4GQ4TM with PID 12620 (D:\java_code\2024test\hub-example\hub-ware\example-biz-a\target\classes started by HONOR in D:\java_code\2024test\hub-example)
2024-02-25 11:49:31.216  INFO 12620 --- [           main] com.hub.BizAApplication                  : No active profile set, falling back to default profiles: default
2024-02-25 11:49:31.682  WARN 12620 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.hub]' package. Please check your configuration.
2024-02-25 11:49:31.944  INFO 12620 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2024-02-25 11:49:31.944  INFO 12620 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-02-25 11:49:31.944  INFO 12620 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.56]
2024-02-25 11:49:32.016  INFO 12620 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-02-25 11:49:32.016  INFO 12620 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 759 ms
2024-02-25 11:49:32.242  INFO 12620 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2024-02-25 11:49:32.309  INFO 12620 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.3.1 
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.


,------.                           ,--.  ,--.         ,--.                         
|  .--. '  ,--,--.  ,---.   ,---.  |  '--'  |  ,---.  |  |  ,---.   ,---.  ,--.--. 
|  '--' | ' ,-.  | | .-. | | .-. : |  .--.  | | .-. : |  | | .-. | | .-. : |  .--' 
|  | --'  \ '-'  | ' '-' ' \   --. |  |  |  | \   --. |  | | '-' ' \   --. |  |    
`--'       `--`--' .`-  /   `----' `--'  `--'  `----' `--' |  |-'   `----' `--'    
                   `---'                                   `--'                        is intercepting.

2024-02-25 11:49:32.765  INFO 12620 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2024-02-25 11:49:32.781  INFO 12620 --- [           main] com.hub.BizAApplication                  : Started BizAApplication in 1.861 seconds (JVM running for 2.476)
BizAApplication模塊啟動成功?。?

Process finished with exit code -1

13總結(jié):避坑記錄:

13.1: pagehelper分頁組件版本問題導(dǎo)致循環(huán)依賴報(bào)錯(cuò)原來版本為1.4.0.啟動效果為:

解決方法:將分頁組件版本改為1.4.1完美解決

13.2:數(shù)據(jù)庫連接池參數(shù)錯(cuò)誤導(dǎo)致報(bào)錯(cuò):

數(shù)據(jù)庫連接池參數(shù)為:com.mysql.jdbc.Driver

解決方法:將數(shù)據(jù)庫連接池名稱改為:com.mysql.cj.jdbc.Driver

到此這篇關(guān)于Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Maven和IDEA搭建多模塊內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 基于Java的Spring框架來操作FreeMarker模板的示例

    基于Java的Spring框架來操作FreeMarker模板的示例

    這篇文章主要介紹了基于Java的Spring框架來操作FreeMarker模板的示例,講到了用于進(jìn)行web模板文件的插值操作等例子,需要的朋友可以參考下
    2016-03-03
  • 關(guān)于Feign的覆寫默認(rèn)配置和Feign的日志

    關(guān)于Feign的覆寫默認(rèn)配置和Feign的日志

    這篇文章主要介紹了關(guān)于Feign的覆寫默認(rèn)配置和Feign的日志方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • 關(guān)于springboot響應(yīng)式編程整合webFlux的問題

    關(guān)于springboot響應(yīng)式編程整合webFlux的問題

    在springboot2.x版本中提供了webFlux依賴模塊,該模塊有兩種模型實(shí)現(xiàn):一種是基于功能性端點(diǎn)的方式,另一種是基于SpringMVC注解方式,今天通過本文給大家介紹springboot響應(yīng)式編程整合webFlux的問題,感興趣的朋友一起看看吧
    2022-01-01
  • Java 多線程傳值的四種方法

    Java 多線程傳值的四種方法

    這篇文章主要介紹了Java 多線程傳值的四種方法,幫助大家更好的理解和學(xué)習(xí)Java,感興趣的朋友可以了解下
    2020-09-09
  • spring boot 1.5.4 web容器定制(端口號等修改)方法

    spring boot 1.5.4 web容器定制(端口號等修改)方法

    下面小編就為大家?guī)硪黄猻pring boot 1.5.4 web容器定制(端口號等修改)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06
  • SpringBoot中@ComponentScan的使用詳解

    SpringBoot中@ComponentScan的使用詳解

    這篇文章主要介紹了SpringBoot中@ComponentScan的使用詳解,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-11-11
  • Java中的ThreadPoolExecutor線程池原理細(xì)節(jié)解析

    Java中的ThreadPoolExecutor線程池原理細(xì)節(jié)解析

    這篇文章主要介紹了Java中的ThreadPoolExecutor線程池原理細(xì)節(jié)解析,ThreadPoolExecutor是一個(gè)線程池,最多可使用7個(gè)參數(shù)來控制線程池的生成,使用線程池可以避免創(chuàng)建和銷毀線程的資源損耗,提高響應(yīng)速度,并且可以管理線程池中線程的數(shù)量和狀態(tài)等等,需要的朋友可以參考下
    2023-12-12
  • IDEA與JDK、Maven安裝配置完整步驟解析

    IDEA與JDK、Maven安裝配置完整步驟解析

    這篇文章主要介紹了如何安裝和配置IDE(IntelliJ?IDEA),包括IDE的安裝步驟、JDK的下載與配置、Maven的安裝與配置,以及如何在IDE中使用Maven進(jìn)行Java開發(fā),需要的朋友可以參考下
    2025-03-03
  • Java  隊(duì)列 Queue 用法實(shí)例詳解

    Java 隊(duì)列 Queue 用法實(shí)例詳解

    本文實(shí)例講述了Java內(nèi)置隊(duì)列類Queue用法,分享給大家供大家參考
    2017-04-04
  • Future與FutureTask接口實(shí)現(xiàn)示例詳解

    Future與FutureTask接口實(shí)現(xiàn)示例詳解

    這篇文章主要為大家介紹了Future與FutureTask接口實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-10-10

最新評論