Skip to content

Commit

Permalink
Add documentation for supported Spring Data annotations. (#483)
Browse files Browse the repository at this point in the history
closes #168
  • Loading branch information
wetted authored Aug 31, 2023
1 parent 1210acb commit c400729
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ developers=Graeme Rocher


springbootapi=https://docs.spring.io/spring-boot/docs/current/api
springdataapi=https://docs.spring.io/spring-data/data-commons/docs/current/api/
micronautcache=https://micronaut-projects.github.io/micronaut-cache/latest/api/io/micronaut/cache/
micronautspringapi=https://micronaut-projects.github.io/micronaut-spring/latest/api
micronautdataapi=https://micronaut-projects.github.io/micronaut-data/latest/api/io/micronaut/
52 changes: 52 additions & 0 deletions src/main/docs/guide/springToMicronaut/springDataAnnotations.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Micronaut Data supports Spring Data annotations. To use them add the following dependency:

dependency:micronaut-data-processor[scope="annotationProcessor", groupId="io.micronaut.data"]

The following table summarizes the Spring Data annotations that Micronaut Data supports and the Micronaut annotation that they map to at compilation time:

.Supported Spring Data Annotations
|===
|Spring Data Annotation|Micronaut Data Annotation|Notes

|link:{springdataapi}org/springframework/data/annotation/CreatedDate.html[@CreatedDate]
|link:{micronautdataapi}data/annotation/DateCreated.html[@DateCreated]
| Example `@CreatedDate private long createdDate`.

|link:{springdataapi}org/springframework/data/annotation/Id.html[@Id]
|link:{micronautdataapi}data/annotation/Id.html[@Id]
| Example `@Id private long id`.

|link:{springdataapi}org/springframework/data/annotation/LastModifiedDate.html[@LastModifiedDate]
|link:{micronautdataapi}data/annotation/DateUpdated.html[@DateUpdated]
| Example `@LastModifiedDate private long modifiedDate`.

|link:{springdataapi}org/springframework/data/annotation/PersistenceConstructor.html[@PersistenceConstructor]
|link:{micronautapi}core/annotation/Creator.html[@Creator]
| Example `@PersistenceConstructor public User(String name, Integer age)`.

|link:{springdataapi}org/springframework/data/annotation/Persistent.html[@Persistent]
|link:{micronautdataapi}data/annotation/MappedEntity.html[@MappedEntity]
| Example `@Persistent public class User`.

|link:{springapi}org/springframework/stereotype/Repository.html[@Repository]
|link:{micronautdataapi}data/annotation/Repository.html[@Repository]
| Example `@Repository interface PersonRepository extends CrudRepository`.

|link:{springapi}org/springframework/transaction/event/TransactionalEventListener.html[@TransactionalEventListener]
|link:{micronautdataapi}transaction/annotation/TransactionalEventListener.html[@TransactionalEventListener]
| Example `@TransactionalEventListener public void handleEvent(MyEvent event)`.

|link:{springapi}org/springframework/transaction/annotation/Transactional.html[@Transactional]
|link:{micronautdataapi}transaction/annotation/Transactional.html[@Transactional]
| Example `@Transactional @Service public class MyService`.

|link:{springdataapi}org/springframework/data/annotation/Transient.html[@Transient]
|link:{micronautdataapi}data/annotation/Transient.html[@Transient]
| Example `@Transient private String ssn`.

|link:{springdataapi}org/springframework/data/annotation/Version.html[@Version]
|link:{micronautdataapi}data/annotation/Version.html[@Version]
| Example `@Version private long version`.
|===


1 change: 1 addition & 0 deletions src/main/docs/guide/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ springToMicronaut:
title: Transforming Spring Applications into Micronaut Applications
springToMicronautStart: Build Configuration
springAnnotations: Supported Spring Annotations
springDataAnnotations: Supported Spring Data Annotations
springInterfaces: Supported Spring Interfaces
springEvents: Supported Spring Events
springMvc: Writing Spring MVC Controllers
Expand Down

0 comments on commit c400729

Please sign in to comment.