0

We have Spring framework (version 5.3.22) based application, not a spring boot.

We have added springdoc-openapi (1.6.11) dependency along with below openapi configuration.

@Configuration 
@EnableWebMvc 
@ComponentScan(basePackages = {"org.springdoc"}) 
@Import({org.springdoc.core.SpringDocConfiguration.class, 
         org.springdoc.webmvc.core.SpringDocWebMvcConfiguration.class, 
         org.springdoc.webmvc.ui.SwaggerConfig.class, 
         org.springdoc.core.SwaggerUiConfigProperties.class, 
         org.springdoc.core.SwaggerUiOAuthProperties.class, 
         org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration.class}) 
public class OpenApiConfig implements WebMvcConfigurer { }

In our application, we have multiple projects having mixed of Java configurations and XML based configurations.

Both types of classes (java config like @controller/@service and XML definitions like <bean id="".... >) are having dependencies injected through @Autowired.

The classes having beans created through component scanning (@controller/@service) are working well, all the injected dependecies are resolved as expected. But the classes having XML definitions are having issues, where dependencies injected through setter and bean ref are working fine, but the dependencies injected through @Autowired are found as null at runtime. Looks like @Autowired annotation itself is not getting resolved while creating bean of such classes. We have also verified that our XML context file has <context:annotation-config /> defined and so @Autowired should get resolved here.

Without this springdoc-openpi dependency and these OpenApiConfig, we are not facing this issue.

Does anyone have more insights here ?

0 Answers0