Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring boot 3.0 fail with jersey and spring cloud (open feign, ect) #1295

Closed
OlgaMaciaszek opened this issue Mar 16, 2023 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@OlgaMaciaszek
Copy link
Collaborator

@Fyro-Ing commented on Tue Mar 14 2023

When using Spring boot 3.0 with jersey (not mvc) with spring cloud open feign, start failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.fortuneo.api.esign.Application]: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:524)
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:726)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at ...
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:310)
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150)
	at com.fortuneo.api.esign.Application.main(Application.java:18)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211)
	at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:54)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48)
	at ...

Spring cloud open feign include org.springframework.cloud:spring-cloud-commons with a default config for web mvc

@ConditionalOnProperty(value = "spring.cloud.mvc.token-relay.enabled", matchIfMissing = true)

To reproduce : run starter

https://start.spring.io/#!type=gradle-project&language=java&platformVersion=3.0.4&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=lombok,cloud-feign,jersey

Workaround : set "spring.cloud.mvc.token-relay.enabled" at false

@gbzarelli
Copy link

I went through the same problem when I updated my project to spring boot 3 (PR).

The workaround worked for me, thanks.

@rob-valor
Copy link

rob-valor commented Nov 9, 2023

@OlgaMaciaszek Any progress on this issue?

I'm not sure it is correct to move the issue here. ResourceServerTokenRelayAutoConfiguration is, looking at the property, mvc oriented and depends on classes from web-mvc (like WebMvcConfigurer) but is only checking for GenericWebApplicationContext (web) through the ConditionalOnWebApplication. For me, it seems better that ResourceServerTokenRelayAutoConfiguration has also a @ConditionalOnClass(WebMvcConfigurer.class) to ensure that there is indeed a web-mvc classpath present.

Now, looking at what is in that ResourceServerTokenRelayAutoConfiguration class..., it doesn't seems to do anything useful. All the code that could do any useful work is commented out 😮 🤔 😉

Adding that additional class check could fix the issue and being such a small fix, can be included in the upcoming release. We are currently upgrading our internal libraries to Spring Boot 3.x and also facing the missing class issue 😞

@OlgaMaciaszek
Copy link
Collaborator Author

Looking into it now.

@OlgaMaciaszek
Copy link
Collaborator Author

This is a bug in Commons. Moving it there. Will provide a fix.

@OlgaMaciaszek OlgaMaciaszek transferred this issue from spring-cloud/spring-cloud-openfeign Nov 10, 2023
@OlgaMaciaszek OlgaMaciaszek moved this to In Progress in 2022.0.5 Nov 10, 2023
@OlgaMaciaszek OlgaMaciaszek moved this to In Progress in 2023.0.0 Nov 10, 2023
@OlgaMaciaszek OlgaMaciaszek added this to the 4.0.5 milestone Nov 10, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2022.0.5 Nov 10, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2023.0.0 Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Status: Done
Development

No branches or pull requests

4 participants