Microservice public module (public subproject) construction process

In microservice projects, many duplicate entity classes, public methods, static variables and the like cannot be avoided. We need to build a public module to remove code redundancy

  • Step 1: Create a new module and select the maven project (right-click the parent project gulimall—select New—select Module)
    insert image description here

  • Step 2: Configure pom.xml (import public dependencies), public methods
    insert image description here

  • Step 3: installinsert image description here

  • Step 4: Introduce common modules into other microservices

<!--提取的公共包-->
<dependency>
	<groupId>com.atguigu.gulimall</groupId>
    <artifactId>gulimall-common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44485316/article/details/131135930