Meaven 依赖管理:
1 、 在parent中 建议使用<dependencyManagement> <dependencyManagement>来管理依赖,这样如果有子类继承该parent 子类不会直接添加该依赖,不过子类中声明该依赖时不需要声明版本号,对应的版本号会从父类继承。可以减少版本冲突。
2 <dependencyManagement>
</dependencyManagement>
和
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/>
</parent>
不要共用 。因为其功能是一致的,上述<parent>继后子类中的依赖不会引入,但是子类的依赖 在引入依赖时不需要指定版本号,因为会默认继承parent的版本号和
<dependencyManagerment>的功能一致,当存在parent时dpendencyManagerment还是需要指定版本的
3. 如果父类中采用<dependencies><dependencies>来引入依赖的则子类的对应的依赖也会被引入,子类中不需要再次引入。
4. 当多个模块之间存在相互依赖时,比如 zcy-web依赖zcy-service ,则zcy-service的依赖的jar包会全部导入到zcy-web中。
最佳的学习方法是新建项目,然后实现一遍再自己总结一下