- 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.
- Articulate Studio Cookbook
- Word/Excel 2016高效辦公從入門到精通
- Word/Excel/PPT/PS/移動辦公Office 5合1無師自通
- Excel函數(shù)辭典
- 從零開始學(xué)PowerPoint 2010
- Word Excel PPT 三合一 效率手冊:早做完,不加班
- 非常Easy:Excel高效辦公
- 和秋葉一起學(xué)WPS Office
- Excel 2013實戰(zhàn)應(yīng)用超級手冊
- Excel數(shù)據(jù)處理與統(tǒng)計初步(第4版)
- Excel 2016中文版完全自學(xué)手冊
- MATLAB及Mathematica軟件應(yīng)用
- 教師必須知道的80個Excel函數(shù)
- MATLAB 8.X實戰(zhàn)指南
- 電腦辦公從新手到高手(超值版)