Skip to content

Commit 2e551af

Browse files
committed
Prefer Java configuration over XML.
Closes #2182
1 parent a47666c commit 2e551af

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

src/main/asciidoc/adding-sdr-to-spring-mvc-app.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ NOTE: The following steps are unnecessary if you use Spring Boot. For Boot appli
55

66
You can integrate Spring Data REST with an existing Spring MVC application. In your Spring MVC configuration (most likely where you configure your MVC resources), add a bean reference to the Java configuration class that is responsible for configuring the `RepositoryRestController`. The class name is `org.springframework.data.rest.webmvc.RepositoryRestMvcConfiguration`. The following example shows how to use an `@Import` annotation to add the proper reference:
77

8-
In Java, this would look like:
8+
The configuration would look like:
99

1010
====
11-
[source,java]
11+
.Java
12+
[source,java,role="primary"]
1213
----
1314
import org.springframework.context.annotation.Import;
1415
import org.springframework.data.rest.webmvc.RepositoryRestMvcConfiguration;
@@ -20,12 +21,9 @@ public class MyApplicationConfiguration {
2021
2122
}
2223
----
23-
====
24-
25-
The following example shows the corresponding XML configuration:
2624
27-
====
28-
[source,xml]
25+
.XML
26+
[source,xml,role="secondary"]
2927
----
3028
<bean class="org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration"/>
3129
----

src/main/asciidoc/customizing-json-output.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[customizing-sdr.customizing-json-output]]
22
= Customizing the JSON Output
33

4-
Sometimes in your application, you need to provide links to other resources from a particular entity. For example, a `Customer` response might be enriched with links to a current shopping cart or links to manage resources related to that entity. Spring Data REST provides integration with https://github.com/SpringSource/spring-hateoas[Spring HATEOAS] and provides an extension hook that lets you alter the representation of resources that go out to the client.
4+
Sometimes in your application, you need to provide links to other resources from a particular entity. For example, a `Customer` response might be enriched with links to a current shopping cart or links to manage resources related to that entity. Spring Data REST provides integration with https://github.com/spring-projects/spring-hateoas[Spring HATEOAS] and provides an extension hook that lets you alter the representation of resources that go out to the client.
55

66
[[customizing-sdr.customizing-json-output.representation-model-processor]]
77
== The `RepresentationModelProcessor` Interface

src/main/asciidoc/etags-and-other-conditionals.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[conditional]]
22
= Conditional Operations with Headers
3-
:spring-data-rest-root: ../../../..
3+
:spring-data-rest-root: ../../..
44

55
This section shows how Spring Data REST uses standard HTTP headers to enhance performance, conditionalize operations, and contribute to a more sophisticated frontend.
66

src/main/asciidoc/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Jon Brisbin, Oliver Drotbohm, Greg Turnquist, Jay Bryant
44
:revnumber: {version}
55
:revdate: {localdate}
66
ifdef::backend-epub3[:front-cover-image: image:epub-cover.png[Front Cover,1050,1600]]
7-
:spring-data-commons-docs: ../../../../../spring-data-commons/src/main/asciidoc
7+
:spring-data-commons-docs: ../../../../spring-data-commons/src/main/asciidoc
88

9-
(C) 2012-2021 Original authors
9+
(C) 2012-2022 Original authors
1010

1111
NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
1212

src/main/asciidoc/security.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[[security]]
22
= Security
3-
:spring-data-rest-root: ../../../..
4-
:spring-security-docs: https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle
3+
:spring-data-rest-root: ../../..
4+
:spring-security-docs: https://docs.spring.io/spring-security/reference
55

66
Spring Data REST works quite well with Spring Security. This section shows examples of how to secure your Spring Data REST services with method-level security.
77

88
[[security.pre-and-post]]
99
== `@Pre` and `@Post` Security
1010

11-
The following example from Spring Data REST's test suite shows Spring Security's {spring-security-docs}/#el-pre-post-annotations[PreAuthorization model] (the most sophisticated security model):
11+
The following example from Spring Data REST's test suite shows Spring Security's {spring-security-docs}/servlet/authorization/expression-based.html#_access_control_using_preauthorize_and_postauthorize[PreAuthorization model] (the most sophisticated security model):
1212

1313
.spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/PreAuthorizedOrderRepository.java
1414
====
@@ -18,7 +18,7 @@ The following example from Spring Data REST's test suite shows Spring Security's
1818
include::{spring-data-rest-root}/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/PreAuthorizedOrderRepository.java[tag=code]
1919
----
2020
21-
<1> This Spring Security annotation secures the entire repository. The {spring-security-docs}/#el-common-built-in[Spring Security SpEL expression] indicates that the principal must have `ROLE_USER` in its collection of roles.
21+
<1> This Spring Security annotation secures the entire repository. The {spring-security-docs}/servlet/authorization/expression-based.html[Spring Security SpEL expression] indicates that the principal must have `ROLE_USER` in its collection of roles.
2222
<2> To change method-level settings, you must override the method signature and apply a Spring Security annotation. In this case, the method overrides the repository-level settings with the requirement that the user have `ROLE_ADMIN` to perform a delete.
2323
====
2424

@@ -66,4 +66,4 @@ include::{spring-data-rest-root}/spring-data-rest-tests/spring-data-rest-tests-s
6666
<3> This class extends Spring Security's `WebSecurityConfigurerAdapter` which is used for pure Java configuration of security.
6767
====
6868

69-
The rest of the configuration class is not listed, because it follows {spring-security-docs}/#hello-web-security-java-configuration[standard practices] that you can read about in the Spring Security reference docs.
69+
The rest of the configuration class is not listed, because it follows {spring-security-docs}/servlet/configuration/java.html[standard practices] that you can read about in the Spring Security reference docs.

0 commit comments

Comments
 (0)