- Mastering Spring Boot 2.0
- Dinesh Rajput
- 164字
- 2021-06-25 21:29:15
Changing a library's dependencies
Spring Boot includes auto-configuration based on the starter's JAR, which is available on the classpath of the Spring application. Spring Boot POMs has dependencies on the Starters, so you can override dependency versions by setting the appropriate Maven property in your pom.xml like this:
<properties> <spring.version>5.0.0.RELEASE</spring.version> </properties>
There are good reasons to override dependency version sometimes, such as a bug in the given version, or your company policies. Ideally, you should avoid changing a dependency version because it makes your life more complicated as you won't be able to manage the version's transitive dependencies in your application.
If some libraries don't suit your Spring application, you could exclude them from the classpath of the Spring application. Let's see the following example:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> <exclusions> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency>
As you can see, I have excluded the default logback library from the spring-boot-starter-websocket starter and added the log4j library for application logging.
Let's move to another section about customizing configuration of Spring Boot.
- 辦公軟件高級應用實用教程
- 隨身查:從原始數據到完美Excel圖表
- Excel 2013使用詳解
- Excel 2010在會計與財務管理日常工作中的應用
- SAP ECC 5.0/6.0 總賬系統應用指南(第2版)
- Office 2016三合一職場辦公效率手冊
- Unity 2018 AR與VR開發快速上手
- Oracle CX Cloud Suite
- 財務必須知道的115個Excel函數
- 新編Word/Excel/PPT 2016高效辦公三合一(全彩版)
- Excel行政文秘應用之道
- Office 2021辦公應用實戰從入門到精通
- Excel經典教程:公式與函數
- Excel數據處理與統計初步(第4版)
- AI智能辦公實戰108招:ChatGPT+Word+PowerPoint+WPS