Bug Report Checklist
Description
PR prompted by Issue removed @Component and @Autowired annotations from the ApiClient and Api classes.
Before this change Spring would automatically find the ApiClient and Api classes and they could easily be autowired. Since this change they will not be auto-discovered by Spring and previously working builds will now fail.
You now have to manually provide the classes to Spring by e.g.:
@Bean
public DefaultApi defaultApi(RestTemplate restTemplate) {
return new DefaultApi(new ApiClient(restTemplate));
}
Furthermore the PR only removed the annotations but did not remove the imports of the annotation. See:
@Autowired in ApiClient
@Component in ApiClient
@Autowired in Api
@Component in Api
openapi-generator version
6.5.0
OpenAPI declaration file content or url
Generation Details
Our config is:
<configuration>
<generatorName>java</generatorName>
<inputSpec>somePath</inputSpec>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<openApiNullable>false</openApiNullable>
<useJakartaEe>true</useJakartaEe>
<library>resttemplate</library>
</configOptions>
</configuration>
Steps to reproduce
- Build any spec with the
java generator and resttemplate lib in version 6.4.0 and generated APIs have an @Component annotation
- Build any spec with the
java generator and resttemplate lib in version 6.5.0 and generated APIs do not have it anymore
Related issues/PRs
PR
Issue
Suggest a fix
This should never have been merged in a minor update, since it is a breaking change. But since the damage has already been done now it should at least be documented in the changelog of this version and a migration path should be provided.
Bug Report Checklist
Description
PR prompted by Issue removed
@Componentand@Autowiredannotations from the ApiClient and Api classes.Before this change Spring would automatically find the ApiClient and Api classes and they could easily be autowired. Since this change they will not be auto-discovered by Spring and previously working builds will now fail.
You now have to manually provide the classes to Spring by e.g.:
Furthermore the PR only removed the annotations but did not remove the imports of the annotation. See:
@Autowired in ApiClient
@Component in ApiClient
@Autowired in Api
@Component in Api
openapi-generator version
6.5.0
OpenAPI declaration file content or url
Generation Details
Our config is:
Steps to reproduce
javagenerator andresttemplatelib in version 6.4.0 and generated APIs have an@Componentannotationjavagenerator andresttemplatelib in version 6.5.0 and generated APIs do not have it anymoreRelated issues/PRs
PR
Issue
Suggest a fix
This should never have been merged in a minor update, since it is a breaking change. But since the damage has already been done now it should at least be documented in the changelog of this version and a migration path should be provided.