我需要将在 jdk 8 上运行的现有代码升级到 jdk 11他们在 jdk 1.8 上时获取日志记录,但在我升级后他们没有获取日志记录。是否有任何方式打印这些日志。我们正在使用 spring boot 2.1.0 Release,jdk 11 spring 集成。第一张图片是在 jdk 8 上运行的代码,第二张图片是在 jdk 11 上运行的代码。这是我们正在使用的 pomfile http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>com.oms.integration</groupId>
<artifactId>oms-integration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>oms-integration</name>
<description>Integration between OMS and other systems</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-xml</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.version}</release>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
最佳答案
如果您还升级了 Spring Boot,这意味着您的项目中的所有其他依赖项也将随之升级,那么您不能将苹果与苹果进行比较,因为它已经不仅仅是 Java 切换。
看起来从 5.1 版开始,Spring Framework 不会在 INFO 下记录这些端点。考虑为 org.springframework.web
类别配置 DEBUG,您将再次使用它们。
您的问题是您没有与我们分享有关依赖项版本不匹配的重要信息...
更新
抱歉,必须是 TRACE
。这是 AbstractHandlerMethodMapping
中的一段相关代码:
if (logger.isTraceEnabled()) {
logger.trace("Mapped " + methods.size() + " handler method(s) for " + userType + ": " + methods);
}
关于java - Controller 映射未在启动时记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53327836/