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

Automatically determine Kotlin parameter names in repository methods [DATAJPA-1118] #1461

Closed
spring-projects-issues opened this issue May 14, 2017 · 5 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 14, 2017

Christoph Leiter opened DATAJPA-1118 and commented

In web-mvc I can declare a method where the parameter name is automatically picked up:

@GetMapping fun foo(@RequestParam bar: String): Any { ... }

When I try to create a custom method with arguments in a spring-data-jpa repository interface it doesn't work with the following message:

IllegalArgumentException: Name for parameter binding must not be null or empty! For named parameters you need to use @Param for query method parameters on Java versions < 8.

It would be convenient If this also worked without having to specify @Param("name").

I'm using Kotlin 1.1 on JDK8 with no special compilation options


Issue Links:

  • SPR-15541 Leveraging kotlin-reflect to determine interface method parameters
    ("depends on")
@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 14, 2017

Oliver Drotbohm commented

We basically rely on Spring Frameworks parameter name detection here. I wasn't aware that anything special needs to be done from a Kotlin point of view. Juergen Hoeller, Sébastien Deleuze — can anyone of you chime in here?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 14, 2017

Sébastien Deleuze commented

Indeed, Christoph could you please create an issue on https://jira.spring.io/browse/SPR about leveraging kotlin-reflect to determine interface method parameters when Kotlin is used ?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 14, 2017

Christoph Leiter commented

Thanks, sure, new issue here: https://jira.spring.io/browse/SPR-15541

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2017

Sébastien Deleuze commented

FYI SPR-15541 is now fixed and available in Spring Framework 5 snapshots, as well as in the upcoming Spring Framework 5 RC4, so I think on Framework side we should be fine now, see this commit for more details.

Christoph Leiter Could you perform new tests using Spring Boot 2.0 an Spring Framework 5 snapshots with Spring Data JPA?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 28, 2019

Jens Schauder commented

I'm assuming the fix for SPR-15541 fixed this one.

If this is still an issue please reopen this ticket or create a new one

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

Successfully merging a pull request may close this issue.

None yet
2 participants