Search code examples
springspring-bootspring-data-jpamicronaut

Can I use spring data jpa with Micronaut?


I would like to extend my TestRepository interface with JpaRepository and utilize the features such as jpa method queries, paging and sorting without manually defining entity manager bean and without writing any sql. P.S. In micronaut project


Solution

  • Edit - July 2019

    They have announced a spring data equivalent named Micronaut Data


    Micronaut does not support Spring's AOP implementation right now. So you should not expect to use an object as Repository by simply implementing JpaRepository<T,ID>

    However you can write a spring based app/library then add this jar as a micronaut project dependency... It should work in theory. Maybe some kind of bridge needed to share environment/profile info and retrieve this repositories to micronaut context

    Or, as mentinoned in comments, you can write your own Repository stubs with Introduction Advice of micronaut. If you generally use @Query annotation in spring repositories, it should be quite easy to implement an equivalent for micronaut app