Skip to content

Commit

Permalink
Bundle Javadoc with Antora documentation site.
Browse files Browse the repository at this point in the history
Closes #3549
  • Loading branch information
mp911de committed Jul 31, 2024
1 parent c438348 commit c7e3242
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ target/
.DS_Store
node_modules
package-lock.json
package.json
node
build/
.mvn/.gradle-enterprise
10 changes: 10 additions & 0 deletions spring-data-jpa-distribution/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dependencies": {
"antora": "3.2.0-alpha.6",
"@antora/atlas-extension": "1.0.0-alpha.2",
"@antora/collector-extension": "1.0.0-alpha.7",
"@asciidoctor/tabs": "1.0.0-beta.6",
"@springio/antora-extensions": "1.13.0",
"@springio/asciidoctor-extensions": "1.0.0-alpha.11"
}
}
2 changes: 1 addition & 1 deletion spring-data-jpa-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</plugin>

<plugin>
<groupId>io.spring.maven.antora</groupId>
<groupId>org.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
</plugin>
</plugins>
Expand Down
10 changes: 4 additions & 6 deletions src/main/antora/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
# The purpose of this Antora playbook is to build the docs in the current branch.
antora:
extensions:
- '@antora/collector-extension'
- require: '@springio/antora-extensions/root-component-extension'
- require: '@springio/antora-extensions'
root_component_name: 'data-jpa'
site:
title: Spring Data JPA
url: https://docs.spring.io/spring-data/jpa/reference/
url: https://docs.spring.io/spring-data/jpa/reference
content:
sources:
- url: ./../../..
Expand All @@ -22,13 +21,12 @@ content:
start_path: src/main/antora
asciidoc:
attributes:
page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
chomp: 'all'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
- '@springio/asciidoctor-extensions/javadoc-extension'
sourcemap: true
urls:
latest_version_segment: ''
Expand All @@ -38,5 +36,5 @@ runtime:
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.3/ui-bundle.zip
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
snapshot: true
10 changes: 9 additions & 1 deletion src/main/antora/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ nav:
- modules/ROOT/nav.adoc
ext:
collector:
- run:
command: ./mvnw test-compile
local: true
- run:
command: ./mvnw validate process-resources -pl :spring-data-jpa-distribution -am -Pantora-process-resources
local: true
scan:
dir: spring-data-jpa-distribution/target/classes/
dir: spring-data-jpa-distribution/target/classes
- run:
command: ./mvnw package -Pdistribute
local: true
scan:
dir: target/antora
3 changes: 2 additions & 1 deletion src/main/antora/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
** xref:envers/configuration.adoc[]
** xref:envers/usage.adoc[]
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
* xref:attachment$api/java/index.html[Javadoc,role=link-external, window=_blank]
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external, window=_blank]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Spring Data JPA offers the following strategies to detect whether an entity is n
If the identifier property is `null`, then the entity is assumed to be new.
Otherwise, it is assumed to be not new.
2. Implementing `Persistable`: If an entity implements `Persistable`, Spring Data JPA delegates the new detection to the `isNew(…)` method of the entity. See the link:$$https://docs.spring.io/spring-data/data-commons/docs/current/api/index.html?org/springframework/data/domain/Persistable.html$$[JavaDoc] for details.
3. Implementing `EntityInformation`: You can customize the `EntityInformation` abstraction used in the `SimpleJpaRepository` implementation by creating a subclass of `JpaRepositoryFactory` and overriding the `getEntityInformation(…)` method accordingly. You then have to register the custom implementation of `JpaRepositoryFactory` as a Spring bean. Note that this should be rarely necessary. See the link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/index.html?org/springframework/data/jpa/repository/support/JpaRepositoryFactory.html$$[JavaDoc] for details.
3. Implementing `EntityInformation`: You can customize the `EntityInformation` abstraction used in the `SimpleJpaRepository` implementation by creating a subclass of `JpaRepositoryFactory` and overriding the `getEntityInformation(…)` method accordingly. You then have to register the custom implementation of `JpaRepositoryFactory` as a Spring bean. Note that this should be rarely necessary. See the javadoc:org.springframework.data.jpa.repository.support.JpaRepositoryFactory[JavaDoc] for details.

Option 1 is not an option for entities that use manually assigned identifiers and no version attribute as with those the identifier will always be non-`null`.
A common pattern in that scenario is to use a common base class with a transient flag defaulting to indicate a new instance and using JPA lifecycle callbacks to flip that flag on persistence operations:
Expand Down
2 changes: 1 addition & 1 deletion src/main/antora/modules/ROOT/pages/jpa/transactions.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[transactions]]
= Transactionality

By default, methods inherited from `CrudRepository` inherit the transactional configuration from link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/org/springframework/data/jpa/repository/support/SimpleJpaRepository.html$$[`SimpleJpaRepository`].
By default, methods inherited from `CrudRepository` inherit the transactional configuration from javadoc:org.springframework.data.jpa.repository.support.SimpleJpaRepository[].
For read operations, the transaction configuration `readOnly` flag is set to `true`.
All others are configured with a plain `@Transactional` so that default transaction configuration applies.
Repository methods that are backed by transactional repository fragments inherit the transactional attributes from the actual fragment method.
Expand Down

0 comments on commit c7e3242

Please sign in to comment.