启动时未映射控制器映射 [英] Controller mapping are not logging at startup
问题描述
我需要将运行在jdk 8上的现有代码升级到jdk 11,升级后,控制器映射不会在启动过程中显示.在此应用程序中,我们定义了一些用于集成的入站网关,我们还定义了一些rest控制器,它们是在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
I have a requirement to upgrade the existing code which runs on jdk 8 to jdk 11 After upgrading it the controller mappings are not showing up during startup.In this application we have defined some inbound gateways for integration and we have also defined few rest controllers, They where getting logging when it was on jdk 1.8 but they are not getting logged after i upgraded.Is there any way those logs are printed. we are using spring boot 2.1.0 Release, jdk 11 spring integration. The first image is the the code running on the jdk 8 and the second image is the one running on jdk 11. Here is pomfile which we are using 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,这也意味着项目中的所有其他依赖项,那么您就无法将Apple与Apple进行比较,因为它已经不仅仅是Java切换.
If you also upgrade Spring Boot, which means all other dependencies in your project as well, then you can’t compare apples with apples since it is already not just Java switching.
从5.1版开始,Spring Framework不会将这些端点记录在INFO下.考虑为org.springframework.web
类别配置DEBUG,您将再次使用它们.
Looks like starting with version 5.1 Spring Framework doesn’t log those endpoints under INFO. Consider to configure DEBUG for the org.springframework.web
category and you’ll them again.
您的问题是您没有与我们分享有关依赖版本不匹配的重要信息...
Your problem was that you didn’t share with us important information about dependencies version mismatch...
更新
对不起,它必须是TRACE
.这是AbstractHandlerMethodMapping
中的相关代码:
Sorry, it must be TRACE
. This is a relevant piece of code from the AbstractHandlerMethodMapping
:
if (logger.isTraceEnabled()) {
logger.trace("Mapped " + methods.size() + " handler method(s) for " + userType + ": " + methods);
}
这篇关于启动时未映射控制器映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!