英文:
Bug in Spring Boot 3.0.3 with EnableWebSocketMessageBroker
问题
我在测试Spring WebSockets示例(https://spring.io/guides/gs/messaging-stomp-websocket/)时发现了一个问题,这个问题出现在Spring Boot的版本3.0.3中。在3.0.2版本中,一切都按预期工作。但在3.0.3版本中,当尝试通过/gs-guide-websocket/info连接时,我收到了404错误。是否有人遇到了相同的问题或者知道这个版本中的一个bug?
以下是一些与问题相关的调试日志:(省略了一些内容)
2023-02-27T12:44:14.955+01:00 DEBUG 17724 --- [main] .s.b.a.l.ConditionEvaluationReportLogger :
============================
条件评估报告
正匹配项:
...
WebMvcAutoConfiguration匹配:
- @ConditionalOnClass找到了所需的类'jakarta.servlet.Servlet','org.springframework.web.servlet.DispatcherServlet','org.springframework.web.servlet.config.annotation.WebMvcConfigurer'(OnClassCondition)
- 找到了'session'范围(OnWebApplicationCondition)
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration#formContentFilter匹配:
- @ConditionalOnProperty(spring.mvc.formcontent.filter.enabled)匹配(OnPropertyCondition)
- @ConditionalOnMissingBean(类型:org.springframework.web.filter.FormContentFilter;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#flashMapManager匹配:
- @ConditionalOnMissingBean(名称:flashMapManager;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#localeResolver匹配:
- @ConditionalOnMissingBean(名称:localeResolver;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#themeResolver匹配:
- @ConditionalOnMissingBean(名称:themeResolver;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.ResourceChainCustomizerConfiguration匹配:
- @ConditionalOnEnabledResourceChain找到了类org.webjars.WebJarAssetLocator(OnEnabledResourceChainCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver匹配:
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.view.InternalResourceViewResolver;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#requestContextFilter匹配:
- @ConditionalOnMissingBean(类型:org.springframework.web.context.request.RequestContextListener,org.springframework.web.filter.RequestContextFilter;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver匹配:
- @ConditionalOnBean(类型:org.springframework.web.servlet.ViewResolver;SearchStrategy:all)找到了bean'defaultViewResolver','beanNameViewResolver','mvcViewResolver';@ConditionalOnMissingBean(名称:viewResolver类型:org.springframework.web.servlet.view.ContentNegotiatingViewResolver;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
WebSocketMessagingAutoConfiguration匹配:
- @ConditionalOnClass找到了所需的类'org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer'(OnClassCondition)
- 找到了'session'范围(OnWebApplicationCondition)
WebSocketServletAutoConfiguration匹配:
- @ConditionalOnClass找到了所需的类'jakarta.servlet.Servlet','jakarta.websocket.server.ServerContainer'(OnClassCondition)
- 找到了'session'范围(OnWebApplicationCondition)
WebSocketServletAutoConfiguration.TomcatWebSocketConfiguration匹配:
- @ConditionalOnClass找到了所需的类'org.apache.catalina.startup.Tomcat','org.apache.tomcat.websocket.server.WsSci'(OnClassCondition)
WebSocketServletAutoConfiguration.TomcatWebSocketConfiguration#websocketServletWebServerCustomizer匹配:
- @ConditionalOnMissingBean(名称:websocketServletWebServerCustomizer;SearchStrategy:all)没有找到任何bean(OnBeanCondition)
负匹配项:
...
WebClientAutoConfiguration:
没有匹配:
- @ConditionalOnClass没有找到所需的类'org.springframework.web.reactive.function.client.WebClient'(OnClassCondition)
WebFluxAutoConfiguration:
没有匹配:
- @ConditionalOnClass没有找到所需的类'org.springframework.web.reactive.config.WebFluxConfigurer'(OnClassCondition)
WebMvcAutoConfiguration#hiddenHttpMethodFilter:
没有匹配:
- @ConditionalOnProperty(spring.mvc.hiddenmethod.filter.enabled)没有找到属性'enabled'(OnPropertyCondition)
WebMvcAutoConfiguration.ProblemDetailsErrorHandlingConfiguration:
没有匹配:
- @ConditionalOnProperty(spring.mvc.problemdetails.enabled=true)没有找到属性'enabled'(OnPropertyCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver:
没有匹配:
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.view.BeanNameViewResolver;SearchStrategy:all)找到了类型为'org.springframework.web.servlet.view.BeanNameViewResolver'的beanNameViewResolver(OnBeanCondition)
WebServiceTemplateAutoConfiguration:
没有匹配:
- @ConditionalOnClass没有找到所需的类'org.springframework.oxm.Marshaller'(OnClassCondition)
WebServicesAutoConfiguration:
没有匹配:
- @ConditionalOnClass没有找到所需的类'org.springframework.ws.transport.http.MessageDispatcherServlet'(OnClassCondition)
WebSessionIdResolverAutoConfiguration:
没有匹配:
- @ConditionalOnClass没有找到所需的类'reactor.core.publisher.Mono'(OnClassCondition)
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration:
没有匹配:
- @ConditionalOnBean(类型:org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration,com.fasterxml.jackson.databind.ObjectMapper;SearchStrategy:all)没有找到任何类型为org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration的bean(OnBeanCondition)
匹配:
- @ConditionalOnClass找到了所需的类'com.fasterxml.jackson.databind.ObjectMapper','org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration'(OnClassCondition)
WebSocketReactiveAuto
英文:
I was testing the example for spring websockets (https://spring.io/guides/gs/messaging-stomp-websocket/) and found a problem in version 3.0.3 in Spring Boot. With version 3.0.2 everything works as expected. But with 3.0.3 i get a 404 error when trying to connect via /gs-guide-websocket/info. Did someone has the same problem or know a bug in this version?
2023-02-27T12:44:14.955+01:00 DEBUG 17724 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
============================
CONDITIONS EVALUATION REPORT
============================
Positive matches:
-----------------
...
WebMvcAutoConfiguration matched:
- @ConditionalOnClass found required classes 'jakarta.servlet.Servlet', 'org.springframework.web.servlet.DispatcherServlet', 'org.springframework.web.servlet.config.annotation.WebMvcConfigurer' (OnClassCondition)
- found 'session' scope (OnWebApplicationCondition)
- @ConditionalOnMissingBean (types: org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration#formContentFilter matched:
- @ConditionalOnProperty (spring.mvc.formcontent.filter.enabled) matched (OnPropertyCondition)
- @ConditionalOnMissingBean (types: org.springframework.web.filter.FormContentFilter; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#flashMapManager matched:
- @ConditionalOnMissingBean (names: flashMapManager; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#localeResolver matched:
- @ConditionalOnMissingBean (names: localeResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.EnableWebMvcConfiguration#themeResolver matched:
- @ConditionalOnMissingBean (names: themeResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.ResourceChainCustomizerConfiguration matched:
- @ConditionalOnEnabledResourceChain found class org.webjars.WebJarAssetLocator (OnEnabledResourceChainCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver matched:
- @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.InternalResourceViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#requestContextFilter matched:
- @ConditionalOnMissingBean (types: org.springframework.web.context.request.RequestContextListener,org.springframework.web.filter.RequestContextFilter; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver matched:
- @ConditionalOnBean (types: org.springframework.web.servlet.ViewResolver; SearchStrategy: all) found beans 'defaultViewResolver', 'beanNameViewResolver', 'mvcViewResolver'; @ConditionalOnMissingBean (names: viewResolver types: org.springframework.web.servlet.view.ContentNegotiatingViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)
WebSocketMessagingAutoConfiguration matched:
- @ConditionalOnClass found required class 'org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer' (OnClassCondition)
- found 'session' scope (OnWebApplicationCondition)
WebSocketServletAutoConfiguration matched:
- @ConditionalOnClass found required classes 'jakarta.servlet.Servlet', 'jakarta.websocket.server.ServerContainer' (OnClassCondition)
- found 'session' scope (OnWebApplicationCondition)
WebSocketServletAutoConfiguration.TomcatWebSocketConfiguration matched:
- @ConditionalOnClass found required classes 'org.apache.catalina.startup.Tomcat', 'org.apache.tomcat.websocket.server.WsSci' (OnClassCondition)
WebSocketServletAutoConfiguration.TomcatWebSocketConfiguration#websocketServletWebServerCustomizer matched:
- @ConditionalOnMissingBean (names: websocketServletWebServerCustomizer; SearchStrategy: all) did not find any beans (OnBeanCondition)
Negative matches:
-----------------
...
WebClientAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'org.springframework.web.reactive.function.client.WebClient' (OnClassCondition)
WebFluxAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'org.springframework.web.reactive.config.WebFluxConfigurer' (OnClassCondition)
WebMvcAutoConfiguration#hiddenHttpMethodFilter:
Did not match:
- @ConditionalOnProperty (spring.mvc.hiddenmethod.filter.enabled) did not find property 'enabled' (OnPropertyCondition)
WebMvcAutoConfiguration.ProblemDetailsErrorHandlingConfiguration:
Did not match:
- @ConditionalOnProperty (spring.mvc.problemdetails.enabled=true) did not find property 'enabled' (OnPropertyCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver:
Did not match:
- @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy: all) found beans of type 'org.springframework.web.servlet.view.BeanNameViewResolver' beanNameViewResolver (OnBeanCondition)
WebServiceTemplateAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'org.springframework.oxm.Marshaller' (OnClassCondition)
WebServicesAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'org.springframework.ws.transport.http.MessageDispatcherServlet' (OnClassCondition)
WebSessionIdResolverAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'reactor.core.publisher.Mono' (OnClassCondition)
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration:
Did not match:
- @ConditionalOnBean (types: org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration,com.fasterxml.jackson.databind.ObjectMapper; SearchStrategy: all) did not find any beans of type org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration (OnBeanCondition)
Matched:
- @ConditionalOnClass found required classes 'com.fasterxml.jackson.databind.ObjectMapper', 'org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration' (OnClassCondition)
WebSocketReactiveAutoConfiguration:
Did not match:
- @ConditionalOnWebApplication did not find reactive web application classes (OnWebApplicationCondition)
WebSocketServletAutoConfiguration.JettyWebSocketConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer' (OnClassCondition)
WebSocketServletAutoConfiguration.UndertowWebSocketConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'io.undertow.websockets.jsr.Bootstrap' (OnClassCondition)
XADataSourceAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class 'jakarta.transaction.TransactionManager' (OnClassCondition)
Exclusions:
-----------
None
Unconditional classes:
----------------------
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration
org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
答案1
得分: 0
我已经测试过它与新的Spring Boot版本3.0.4,一切都再次正常工作。我认为他们在这个版本中修复了一些东西。
英文:
I have tested it with the new Spring Boot version 3.0.4 and there everything works well again. I think they have fixed something in this version.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论