第三节--微服务父工程架构编码构建
约定>配置>编码 第一步: 搭建父工程 本人博客: https://blog.csdn.net/hexu_blog/article/details/104969252 父工程需要注意: 1.字符编码 2.注解生效激活 3.java编译版本选8 4.File Type过滤 第二步:编辑父工程 pom.xml文件 1.新加<packaging>pom</packaging> <groupId>com.hx.springcloud</groupId> <artifactId>cloud2020</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> 2 . 依赖 dependencyManagement:能让所有子元素引用一个依赖而不用显示的列处版本号(让子项目步指定依赖版本号就默认使用父项目的版本号) <!--dependencyManagement:子模块继承之后,提供作用:锁定版本+子modlue不用写groupId和version,只用在父工程--> <dependencyManagement> <dependencies> <!--springboot2.2.2版本--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version> 2.2.2.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <!--springcloud Hoxton.SR1版本--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR1</version> <type>pom</type> <scope>import</scope> </dependency> <!--springcloud alibaba 2.1.0--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2.1.0.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <!-- mysql --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <!-- 引入druid数据源 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <!-- 整合mybatis --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>${mybatis.spring.boot.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> </dependency> </dependencies> </dependencyManagement>