这是我的pom文件,我已经升级到springboot2.5.12,我需要更新或添加任何其他依赖项吗?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.12</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.sams.pricing</groupId>
<artifactId>pricing-user-preference-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>pricing-user-preference-api</name>
<description>Backend API for User-Preference</description>
<properties>
<java.version>11</java.version>
<swagger.version>3.0.0</swagger.version>
<pricing-commons.version>1.2.3</pricing-commons.version>
<ccm.client.version>2.0.14</ccm.client.version>
<jacoco.version>0.8.6</jacoco.version>
<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
<sonar.language>java</sonar.language>
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<coverage.reports>${project.build.directory}/coverage-reports</coverage.reports>
<jacoco.out.ut.file>${coverage.reports}/jacoco-ut.exec</jacoco.out.ut.file>
<jacoco.out.it.file>${coverage.reports}/jacoco-it.exec</jacoco.out.it.file>
<jacoco.out.merged.file>${coverage.reports}/merged-report.exec</jacoco.out.merged.file>
<sonar.jacoco.itReportPaths>${coverage.reports}/jacoco-it.exec</sonar.jacoco.itReportPaths>
<sonar.coverage.jacoco.xmlReportPaths>${coverage.reports}/coverage-report-merged/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.exclusions>
**/utils/*,**/adapter/*,**/config/*,**/request/*,**/response/*,**/proxy/*,**/entity/*,**/exception/*,**/application/*,**/repository/*,**/model/*,
**/dto/*, src/main/java/com/sams/pricing/userpreference/UserPreferenceApiApplication.java
</sonar.coverage.exclusions>
<pricing.security.lib.version>1.0.9</pricing.security.lib.version>
<spring-cloud.version>2020.0.5</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sams.pricing</groupId>
<artifactId>commons</artifactId>
<version>${pricing-commons.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.3.22.RELEASE</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>io.strati.tunr.utils</groupId>
<artifactId>strati-af-tunr-utils-client-spring</artifactId>
<version>${ccm.client.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
<version>1.1.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.openpojo/openpojo -->
<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
<version>0.8.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sams.pricing</groupId>
<artifactId>pricing-security-lib</artifactId>
<version>${pricing.security.lib.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<propertyName>coverageAgent</propertyName>
<append>true</append>
<excludes>
<exclude>**/dto/*</exclude>
<exclude>**/model/*</exclude>
<exclude>**/exception/*</exclude>
<exclude>**/repository/*</exclude>
<exclude>**/utils/*</exclude>
<exclude>**/config/*</exclude>
<exclude>**/request/*</exclude>
<exclude>**/response/*</exclude>
<exclude>**/adapter/*</exclude>
<exclude>**/entity/*</exclude>
<exclude>**/config/*</exclude>
<exclude>src/main/java/com/sams/pricing/userpreference/UserPreferenceApiApplication.java
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${coverage.reports}/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
<append>true</append>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${coverage.reports}/jacoco-ut.exec</dataFile>
<outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
<append>true</append>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${coverage.reports}/jacoco-it.exec</destFile>
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<append>true</append>
<dataFile>${coverage.reports}/jacoco-it.exec</dataFile>
<outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
</configuration>
</execution>
<execution>
<id>merge-unit-and-integration</id>
<phase>post-integration-test</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${coverage.reports}</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${jacoco.out.merged.file}</destFile>
</configuration>
</execution>
<execution>
<id>merge-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${jacoco.out.merged.file}</dataFile>
<outputDirectory>${coverage.reports}/coverage-report-merged</outputDirectory>
</configuration>
</execution>
<!-- Line coverage plugin -->
<execution>
<id>coverage-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${jacoco.out.merged.file}</dataFile>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.79</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3C</forkCount> <!--;Number of parallel JVM = 3 times the number of available processors -->
<useSystemClassLoader>false</useSystemClassLoader>
<reuseForks>true</reuseForks>
<testFailureIgnore>false</testFailureIgnore>
<argLine>${surefireArgLine}</argLine>
<includes>
<include>**/*Test*</include>
</includes>
<excludes>
<exclude>**/FT/**</exclude>
<exclude>**/*IT*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</path>
</annotationProcessorPaths>
</configuration>
<executions>
<execution>
<id>run-annotation-processors-only</id>
<phase>generate-sources</phase>
<configuration>
<compilerArgument>-proc:only</compilerArgument>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<updateDependencies>true</updateDependencies>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>pangaea_snapshots</id>
<url>https://gec-maven-nexus.walmart.com/nexus/content/repositories/pangaea_snapshots
</url>
</snapshotRepository>
<repository>
<id>pangaea_releases</id>
<url>https://gec-maven-nexus.walmart.com/nexus/content/repositories/pangaea_releases
</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>pangaea_releases</id>
<url>https://repository.walmart.com/nexus/content/repositories/pangaea_releases
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>pangaea_snapshots</id>
<url>https://repository.walmart.com/nexus/content/repositories/pangaea_snapshots
</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
我的Junit测试用例抛出此错误
原因:java。lang.ClassNotFoundException:Reactor。util。上下文java的ContextView。基本/jdk。内部的装载机。内置ClassLoader。java上的loadClass(BuiltinClassLoader.java:581)。基本/jdk。内部的装载机。ClassLoaders$AppClassLoader。java上的loadClass(ClassLoaders.java:178)。基本/java。lang.ClassLoader。loadClass(ClassLoader.java:522)。。。87个以上
您需要更新此依赖项:
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.3.22.RELEASE</version>
</dependency>
至版本3.4。x作为springboot 2.5.12使用reactor。净值1.0.18,取决于Reactor堆芯3.4。x(比较https://github.com/reactor/reactor-netty/issues/1388)但你迫使maven使用旧的Reactor核心版本
问题内容: 我对JUnit还是很陌生,我真的不知道对于异常和异常处理有什么最佳实践。 例如,假设我正在为IPAddress类编写测试。它具有一个构造函数IPAddress(String addr),如果addr为null,则将抛出InvalidIPAddressException。据我可以从谷歌搜索中得知,对null参数的测试将如下所示。 在这种情况下,try / catch很有意义,因为我知道异
java.lang.IllegalStateException:未能加载ApplicationContext 原因:org . spring framework . beans . factory . unsatisfieddependencyexception:创建在URL[jar:file:/C:/Users/MDI vya/. m2/repository/io/spring fox/spri
我试图在Eclipse中对我的Spring Boot项目进行单元测试。我遇到的问题是,我的@Autowire s被忽略了。 输出。 我认为这可能与顶部没有@RunWith(SpringRunner.class)有关,但如果我包括这一点,它会尝试运行我的主应用程序,这会引发异常,因为实例变量不是从环境中填充的: 我不确定它为什么要运行这个,而我所做的只是测试。
问题内容: 如何惯用JUnit4来测试某些代码引发异常? 虽然我当然可以做这样的事情: 我记得在这种情况下,有一个批注或一个Assert.xyz或一些不太灵活的JUnit东西。 问题答案: JUnit 4 有对此的支持:
问题是,我正在测试一个方法,但它给我一个404错误,我已经把我的承载令牌在我的请求中,这是合乎逻辑的,因为我需要把头“授权”。当我在《邮差》中提出这个要求时,它给了我很好的结果。我有什么不及格的? monedaServiceTest.java: 输出控制台: