- 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.
- Word/Excel/PPT 2010辦公應用從入門到精通
- Word/Excel/PPT 2013辦公應用從入門到精通
- Office 2016入門與提高
- 快·易·通:2天學會PPT幻燈片設計與制作(2016版)
- 從零開始學Arduino電子設計:創意案例版
- Excel 2016高級應用案例教程(視頻指導版)
- Excel 2010基礎入門與辦公應用
- 中文PowerPoint 2003應用基礎
- Excel函數與公式應用技巧
- 隨身查: 一小時搞定你想要的PPT
- Access快速開發基礎教程
- MATLAB及Mathematica軟件應用
- 金融精英Word實操手冊:世界知名公司這樣制作研究報告
- PPT進化:如何設計一份驚艷的PPT
- AI智能辦公實戰108招:ChatGPT+Word+PowerPoint+WPS