Skip to content

Support @SchemaMapping + @BatchMapping on a class when looking for handlers along with @Controller #287

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

Closed
geliotropvimd opened this issue Feb 15, 2022 · 5 comments

Comments

@geliotropvimd
Copy link

geliotropvimd commented Feb 15, 2022

In this project, we have separated the processes of creating objects and mapping requests. We create objects through Kotlin DSL. @Controller breaks context startup.

Need like this

@SchemaMapping
class TestRes(
    private val testService: TestService,
    private val url: String,
) {
   @QueryMapping
    suspend fun test(): Test= Test(100, "100500")
}

But now we have to use workaround

@Controller
interface ControllerMarker

@SchemaMapping
class TestRes(
    private val testService: TestService,
    private val url: String,
): ControllerMarker {
   @QueryMapping
    suspend fun test(): Test= Test(100, "100500")
}

You need the ability to do the same as in the analogy with RSocket.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 15, 2022
@rstoyanchev
Copy link
Contributor

We haven't had a great experience with similar support in Spring MVC which treated a class-level @RequestMapping as a controller class. After running into multiple, independent issues with frameworks built on top, we're finally removing it in 6.0 spring-projects/spring-framework#22154.

In short, it wouldn't be an issue now, but as the ecosystem around it grows, it can become an issue, so I don't think this is something we'd want to introduce.

I'm not quite sure how @Controller breaks the startup? If it results in duplicate bean definitions, why is not an issue when it is defined on an interface instead? If this is the nature of the issue, do you have component scanning enabled, and if so can you try to configure it to be more precise?

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Feb 16, 2022
@vladimirfx
Copy link

@Controller is composing 2 different concepts: bean registration AND request handling metadata.
In our projects, we use programmatic bean registration with Kotlin Bean DSL that conflicts with automatic bean registration provided by @Controller.
So we need annotation for pure request handling metadata without bean registration.

Analogically for @RequestMapping we fall in trouble after spring-projects/spring-framework#22154

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 21, 2022
@rstoyanchev
Copy link
Contributor

@Controller is composing 2 different concepts: bean registration AND request handling metadata.

Yes but bean registration via component scanning is entirely optional. Especially for you situation, consider customizing it to select what packages to scan or turning it off in favor of explicit @Bean methods only.

@rstoyanchev rstoyanchev added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Apr 19, 2022
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Apr 26, 2022
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues added status: waiting-for-triage An issue we've not yet triaged and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels May 3, 2022
@rstoyanchev rstoyanchev removed the status: waiting-for-triage An issue we've not yet triaged label May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants