OpenAPITools / OpenAPITools/openapi-generator
Consider defining a bean of type 'org.springframework.web.context.request.NativeWebRequest' in your configuration.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hello,
I was migrating spring boot in our framework from Servlet to Reactive Context. In our framework we are using org.openapitools_openapi-generator-core:7.0.0 plugin to generate code from openapi specs.
I was successfully able to resolve all the issues while migrating to Reative context but at one point it was giving me below error for org.springframework.web.context.request.NativeWebRequest.
required a bean of type 'org.springframework.web.context.request.NativeWebRequest' that could not be found.\r\n\r\n\r\nAction:\r\n\r\nConsider defining a bean of type 'org.springframework.web.context.request.NativeWebRequest' in your configuration.
As our framework is being used by other applications, so i do not want them to rewrite controllers for Reactive.
So as of now i did this workaround to duck this error, but it is not a correct implementation.
@Bean
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public NativeWebRequest nativeWebRequest() {
return new ServletWebRequest(new MockHttpServletRequest());
}
Could you please help me for a possible correct solution.
springBootVersion=3.4.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the NativeWebRequest bean failure while migrating generated code from Servlet to Reactive context with Spring Boot 3.4.5. Review the generated controller integration and the reactive configuration involved; done means identifying a correct framework-level solution that does not require consuming applications to rewrite their controllers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100