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

[BUG] Spring boot 3 - can't see interfaces with default methods. "Ignored because not a concrete top-level class" #18403

Open
6 tasks
cassman42 opened this issue Apr 16, 2024 · 0 comments

Comments

@cassman42
Copy link

cassman42 commented Apr 16, 2024

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I'm moving to spring boot 3, generating the interface only classes, all annotations work correctly.
When starting in spring the class is scanned, but for the generated interfaces with default methods
spring logs ::

o.s.c.a.ClassPathBeanDefinitionScanner : Ignored because not a concrete top-level class:

I've tested with spring boot versions 3.0.x 3.1.x and 3.2.x and the same issue appears

openapi-generator version

7.4.0

Generation Details
org.openapitools openapi-generator-maven-plugin 7.4.0 generate ${project.build.directory}/classes/contract/contract.yaml spring true ApiUtil.java
                        <generateApis>true</generateApis>
                        <generateApiTests>false</generateApiTests>
                        <generateModelTests>false</generateModelTests>

                        <apiPackage>true</apiPackage>
                        <modelPackage>true</modelPackage>
                        <apiPackage>com.api</apiPackage>
                        <modelPackage>com.model</modelPackage>
                        <modelNameSuffix></modelNameSuffix>

                        <output>${project.build.directory}/generated-sources</output>
                        <configOptions>
                            
                            <useResponseEntity>true</useResponseEntity>

                            <enablePostProcessFile>true</enablePostProcessFile>
                            <interfaceOnly>true</interfaceOnly>
                            <java8>true</java8>
                            <sourceFolder>openapi</sourceFolder>
                            <dateLibrary>java8</dateLibrary>
                            <useSpringBoot3>true</useSpringBoot3>
                            <useSpringController>true</useSpringController>
                            <library>spring-boot</library>
                            <useTags>true</useTags>
                            <templateDirectory>src/main/resources/mustache</templateDirectory>
                            <useBeanValidation>true</useBeanValidation>
                            <performBeanValidation>true</performBeanValidation>
                            <useOptional>true</useOptional>
                            <hideGenerationTimestamp>true</hideGenerationTimestamp>
                            <unhandledException>true</unhandledException>
                            <useSwaggerUI>false</useSwaggerUI>
                            <annotationLibrary>none</annotationLibrary>
                            <documentationProvider>none</documentationProvider>

                        </configOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
Steps to reproduce

Generate the interface as normal from the contract (my generator config is above)

enable spring logging to see

logging.level.org.springframework.core.io.support=DEBUG
logging.level.org.springframework.context.annotation=DEBUG

Watch the interface be ignored.

Related issues/PRs

none I can see

Suggest a fix

You need to implement your interfaces, and annotate them with @RestController
you don't need any other annotation.
The default interface methods sadly will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant