Skip to content

Commit

Permalink
Bundle Javadoc with Antora documentation site.
Browse files Browse the repository at this point in the history
Closes #2400
  • Loading branch information
mp911de committed Jul 31, 2024
1 parent aaadc34 commit 21e11ad
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ out/
_site
node_modules
package-lock.json
package.json
node
.mvn/.gradle-enterprise
10 changes: 10 additions & 0 deletions spring-data-rest-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-rest-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</plugin>

<plugin>
<groupId>io.spring.maven.antora</groupId>
<groupId>org.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
</plugin>
</plugins>
Expand Down
8 changes: 3 additions & 5 deletions src/main/antora/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# 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-rest'
site:
title: Spring Data REST
Expand All @@ -17,13 +16,12 @@ content:
worktrees: true
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 @@ -33,5 +31,5 @@ runtime:
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
snapshot: true
5 changes: 5 additions & 0 deletions src/main/antora/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ ext:
local: true
scan:
dir: spring-data-rest-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 @@ -27,4 +27,5 @@
** xref:customizing/custom-jackson-deserialization.adoc[]
** xref:customizing/configuring-cors.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]
16 changes: 8 additions & 8 deletions src/main/antora/modules/ROOT/pages/events.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

The REST exporter emits eight different events throughout the process of working with an entity:

* `BeforeCreateEvent`
* `AfterCreateEvent`
* `BeforeSaveEvent`
* `AfterSaveEvent`
* `BeforeLinkSaveEvent`
* `AfterLinkSaveEvent`
* `BeforeDeleteEvent`
* `AfterDeleteEvent`
* javadoc:org.springframework.data.rest.core.event.BeforeCreateEvent[]
* javadoc:org.springframework.data.rest.core.event.AfterCreateEvent[]
* javadoc:org.springframework.data.rest.core.event.BeforeSaveEvent[]
* javadoc:org.springframework.data.rest.core.event.AfterSaveEvent[]
* javadoc:org.springframework.data.rest.core.event.BeforeLinkSaveEvent[]
* javadoc:org.springframework.data.rest.core.event.AfterLinkSaveEvent[]
* javadoc:org.springframework.data.rest.core.event.BeforeDeleteEvent[]
* javadoc:org.springframework.data.rest.core.event.AfterDeleteEvent[]

[[events.application-listener]]
== Writing an `ApplicationListener`
Expand Down
4 changes: 2 additions & 2 deletions src/main/antora/modules/ROOT/pages/integration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sometimes you need to add links to exported resources in your own custom-built S

* Manually assembling links.
* Using Spring HATEOAS's https://docs.spring.io/spring-hateoas/docs/current/reference/html/#fundamentals.obtaining-links.builder[`LinkBuilder`] with `linkTo()`, `slash()`, and so on.
* Using Spring Data REST's implementation of https://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest/webmvc/support/RepositoryEntityLinks.html[`RepositoryEntityLinks`].
* Using Spring Data REST's implementation of javadoc:org.springframework.data.rest.webmvc.support.RepositoryEntityLinks[].

The first suggestion is terrible and should be avoided at all costs. It makes your code brittle and high-risk. The second is handy when creating links to other hand-written Spring MVC controllers. The last one, which we explore in the rest of this section, is good for looking up resource links that are exported by Spring Data REST.

Expand Down Expand Up @@ -54,4 +54,4 @@ With the class in the preceding example, you can use the following operations:

|===

NOTE: All of the search-based links support extra parameters for paging and sorting. See https://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest/webmvc/support/RepositoryEntityLinks.html[`RepositoryEntityLinks`] for the details. There is also `linkFor(Class<?> type)`, but that returns a Spring HATEOAS `LinkBuilder`, which returns you to the lower level API. Try to use the other ones first.
NOTE: All of the search-based links support extra parameters for paging and sorting. See javadoc:org.springframework.data.rest.webmvc.support.RepositoryEntityLinks[] for the details. There is also `linkFor(Class<?> type)`, but that returns a Spring HATEOAS `LinkBuilder`, which returns you to the lower level API. Try to use the other ones first.
2 changes: 1 addition & 1 deletion src/main/antora/modules/ROOT/pages/intro.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
= Introduction
:page-section-summary-toc: 1

REST web services have become the number one means for application integration on the web. In its core, REST defines that a system that consists of resources with which clients interact. These resources are implemented in a hypermedia-driven way. link:{springDocsUrl}/web.html#spring-web[Spring MVC] and link:{springDocsUrl}/web-reactive.html#spring-webflux[Spring WebFlux] each offer a solid foundation to build theses kinds of services. However, implementing even the simplest tenet of REST web services for a multi-domain object system can be quite tedious and result in a lot of boilerplate code.
REST web services have become the number one means for application integration on the web. In its core, REST defines that a system that consists of resources with which clients interact. These resources are implemented in a hypermedia-driven way. link:{springDocsUrl}/web.html#spring-web[Spring MVC] and link:{springDocsUrl}/web-reactive.html#spring-webflux[Spring WebFlux] each offer a solid foundation to build these kinds of services. However, implementing even the simplest tenet of REST web services for a multi-domain object system can be quite tedious and result in a lot of boilerplate code.

Spring Data REST builds on top of the Spring Data repositories and automatically exports those as REST resources. It leverages hypermedia to let clients automatically find functionality exposed by the repositories and integrate these resources into related hypermedia-based functionality.

0 comments on commit 21e11ad

Please sign in to comment.