Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1265

Repository methods are not overriden properly in Kotlin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      For java findById method we can write to methods in kotlin:

      override fun findById(id: Long?): Optional<User>
      
      override fun findById(id: Long): Optional<User>
      

      The first one with nullable parameters is invoked by data-rest. If we add annotations to it e.g. @PreAuthorize it works as expected. But with -Xjsr305=strict compiler argument that is added by spring Initialzr the second one is the only possible override, though it doesn't work the right way, cause it's not invoked through data-rest.

      Project to reproduce described behavior is linked to the issue.

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            Sl.aleksandr Aleksandr
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: