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

This resolved issus is supported by Kotlin? #889

Closed
ab908ab opened this issue Oct 3, 2020 · 4 comments
Closed

This resolved issus is supported by Kotlin? #889

ab908ab opened this issue Oct 3, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@ab908ab
Copy link

ab908ab commented Oct 3, 2020

#879

@ab908ab
Copy link
Author

ab908ab commented Oct 3, 2020

This is working.

    @RouterOperations(
        RouterOperation(path = "/api/v1/users", beanClass = UserService::class, beanMethod = "getUsers"),
        RouterOperation(path = "/api/v1/users/{userId}", beanClass = UserService::class, beanMethod = "getUser")
    )
    @Bean
    fun router(): RouterFunction<ServerResponse> = coRouter {
        GET("/api/v1/users", userHandler::findUsers)
        GET("/api/v1/users/{userId}", userHandler::findUser)
    }

But, this is not working.

    @RouterOperations(
        RouterOperation(path = "/api/v1/users", beanClass = UserService::class, beanMethod = "getUsers"),
        RouterOperation(path = "/api/v1/users/{userId}", beanClass = UserService::class, beanMethod = "getUser")
    )
    @Bean
    fun router(): RouterFunction<ServerResponse> = coRouter {
        ("/api/v1").nest {
            ("/users").nest {
                GET("", userHandler::findUsers)
                GET("/{userId}", userHandler::findUser)
            }
        }
    }

@ab908ab
Copy link
Author

ab908ab commented Oct 3, 2020

By the way, this is working.

    @RouterOperations(
        RouterOperation(path = "/api/v1/users/{userId}", beanClass = UserService::class, beanMethod = "getUser")
    )
    @Bean
    fun router() = coRouter {
        ("/api/v1").nest {
            ("/users").nest {
                GET("", userHandler::findUsers)
                GET("/{userId}", userHandler::findUser)
            }
        }
    }

@ab908ab
Copy link
Author

ab908ab commented Oct 3, 2020

I tryed to add method param.
This is working!!

    @RouterOperations(
        RouterOperation(path = "/api/v1/users", beanClass = UserService::class, beanMethod = "getUsers", method = [RequestMethod.GET]),
        RouterOperation(path = "/api/v1/users/{userId}", beanClass = UserService::class, beanMethod = "getUser", method = [RequestMethod.GET])
    )
    @Bean
    fun router() = coRouter {
        ("/api/v1").nest {
            ("/users").nest {
                GET("", userHandler::findUsers)
                GET("/{userId}", userHandler::findUser)
            }
        }
    }

method is required?

@bnasslahsen
Copy link
Contributor

@908ab,

From your description, method should not be required.
But adding it is just a workaround, for your case.

This should be fixed for the next release.
You can already test the fix using the last SNAPSHOT;

@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants