English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
يدير Spring Boot التبعية والتعديلات بشكل تلقائي. يقدم كل إصدار من Spring Boot قائمة بالتبعيات التي يدعمها. يمكن مقارنة قائمة التبعيات مع Maven التي تستخدم معًا قائمة الموادجزء من (إعداد بداية الربيع). لذلك، لا نحتاج إلى تحديد إصدار التبعية في الإعدادات. يدير Spring Boot التبعية بنفسه. عند تحديث إصدار Spring Boot، يقوم Spring Boot بتحديث جميع التبعيات بشكل تلقائي وبطريقة متسقة.
يقدم معلومات التبعية بشكل مركزي عن طريق تحديد إصدار Spring Boot في مكان واحد. يساعدها في التبديل بين الإصدارات المختلفة. يمنع عدم التطابق بين مكتبات Spring Boot المختلفة. نحن بحاجة فقط إلى كتابة اسم المكتبة وتحديد الإصدار. هذا مفيد جدًا في مشاريع متعددة المكونات.
مشروع Maven من يورث spring-boot-starter-parent الميزات التالية:
الافتراضي إصدار محول Java UTF-8 مصدر الت编码 يورث من spring-boot-dependency-pom Dependency Section Dependency Section
When configuring the project, the following spring-boot-starter-parent will be automatically inherited.
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.2.BUILD-SNAPSHOT</version> <!-- lookup parent from repository --> <relativePath/> </parent>
For example, if you want to add another dependency with the same artifact as the injected one, inject the dependency again <properties>tag to override
We can also use <java.version>Use the tag to change the Java version.
<properties> <java.version>1.8</java.version> </properties>
We can also add pom.xml file Add Maven plugin. It will package the project into an executable jar in the file.
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
If we do not want to use spring-boot starter-parent If we want to use dependency management advantages but still use dependencies, we can use
<dependencyManagement> <dependencies> <dependency> -- import dependency management from Spring Boot -- <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.2.2.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
لا يسمح بتغطية هذه الاعتماديات. لتغطية، نحتاج إلى إضافة في المشروع}}
على سبيل المثال، لتحديث آخر spring-data-releasetrain ، أضف依赖يات التالية في ملف pom.xml.
<dependencyManagement> <dependencies> <!--Override Spring Data release train--> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-releasetrain</artifactId> <version>Fowler-SR2</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.2.2.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>