getCorsConfigurations() {
34 | return super.getCorsConfigurations();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/StaticResourceProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.config;
17 |
18 | import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
19 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
20 |
21 | /**
22 | * SPI to be able to register extensions that add static resource routes. See
23 | * {@code org.springframework.data.rest.webmvc.halexplorer.HalExplorerConfiguration} in the HAL Explorer module.
24 | *
25 | * @author Oliver Drotbohm
26 | * @since 3.2
27 | */
28 | public interface StaticResourceProvider {
29 |
30 | /**
31 | * Customize the given {@link ResourceHandlerRegistry}.
32 | *
33 | * @param registry must not be {@literal null}.
34 | * @param configuration must not be {@literal null}.
35 | */
36 | void customizeResources(ResourceHandlerRegistry registry, RepositoryRestConfiguration configuration);
37 | }
38 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/BindContextFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json;
17 |
18 | import org.springframework.data.rest.webmvc.json.patch.BindContext;
19 |
20 | import com.fasterxml.jackson.databind.ObjectMapper;
21 |
22 | /**
23 | * Factory to create {@link BindContext} instances.
24 | *
25 | * @author Oliver Drotbohm
26 | */
27 | public interface BindContextFactory {
28 |
29 | /**
30 | * Creates a {@link BindContext} for the given {@link ObjectMapper}.
31 | *
32 | * @param mapper must not be {@literal null}.
33 | * @return will never be {@literal null}.
34 | */
35 | BindContext getBindContextFor(ObjectMapper mapper);
36 | }
37 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/JsonSchemaPropertyCustomizer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json;
17 |
18 | import org.springframework.data.rest.webmvc.json.JsonSchema.JsonSchemaProperty;
19 | import org.springframework.data.util.TypeInformation;
20 |
21 | /**
22 | * Callback interface to customize the {@link JsonSchemaProperty} created by default for a given type.
23 | *
24 | * @author Oliver Gierke
25 | * @since 2.4
26 | * @soundtrack Superflight - Four Sided Cube (Bellyjam)
27 | */
28 | public interface JsonSchemaPropertyCustomizer {
29 |
30 | /**
31 | * Returns the customized {@link JsonSchemaProperty} based on the given one and the given type.
32 | *
33 | * @param property will never be {@literal null}.
34 | * @param type will never be {@literal null}.
35 | * @return
36 | */
37 | JsonSchemaProperty customize(JsonSchemaProperty property, TypeInformation> type);
38 | }
39 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @org.springframework.lang.NonNullApi
17 | package org.springframework.data.rest.webmvc.json;
18 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/LateObjectEvaluator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json.patch;
17 |
18 | /**
19 | *
20 | * Strategy interface for resolving values from an operation definition.
21 | *
22 | *
23 | * {@link Patch} implementation generically defines a patch without being tied to any particular patch specification.
24 | * But it's important to know the patch format when resolving the value of an operation, as the value format will likely
25 | * be tied to the patch specification. For example, the value
attribute of a JSON Patch operation will
26 | * contain a JSON object. A different patch specification may define values in some non-JSON format.
27 | *
28 | *
29 | * This interface allows for pluggable evaluation of values, allowing {@link Patch} to remain independent of any
30 | * specific patch representation.
31 | *
32 | *
33 | * @author Craig Walls
34 | */
35 | interface LateObjectEvaluator {
36 |
37 | Object evaluate(Class> type);
38 | }
39 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/PatchException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json.patch;
17 |
18 | /**
19 | * Exception thrown if an error occurs in the course of applying a Patch.
20 | *
21 | * @author Craig Walls
22 | * @author Oliver Gierke
23 | */
24 | public class PatchException extends RuntimeException {
25 |
26 | private static final long serialVersionUID = 1L;
27 |
28 | public PatchException(String message) {
29 | super(message);
30 | }
31 |
32 | public PatchException(String message, Exception e) {
33 | super(message, e);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/RemoveOperation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json.patch;
17 |
18 | import org.springframework.data.rest.webmvc.json.patch.SpelPath.UntypedSpelPath;
19 |
20 | /**
21 | * Operation that removes the value at the given path. Will throw a {@link PatchException} if the given path isn't valid
22 | * or if the path is non-nullable.
23 | *
24 | * @author Craig Walls
25 | * @author Oliver Gierke
26 | */
27 | class RemoveOperation extends PatchOperation {
28 |
29 | /**
30 | * Constructs the remove operation
31 | *
32 | * @param path The path of the value to be removed. (e.g., '/foo/bar/4')
33 | */
34 | private RemoveOperation(UntypedSpelPath path) {
35 | super("remove", path);
36 | }
37 |
38 | public static RemoveOperation valueAt(String path) {
39 | return new RemoveOperation(SpelPath.untyped(path));
40 | }
41 |
42 | @Override
43 | void perform(Object target, Class> type, BindContext context) {
44 | path.bindForWrite(type, context).removeFrom(target);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @org.springframework.lang.NonNullApi
17 | package org.springframework.data.rest.webmvc.json.patch;
18 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.mapping;
17 |
18 | import org.springframework.hateoas.Link;
19 | import org.springframework.hateoas.Links;
20 |
21 | /**
22 | * A service to collect all standard links that need to be added to a certain object.
23 | *
24 | * @author Oliver Gierke
25 | */
26 | public interface LinkCollector {
27 |
28 | /**
29 | * Returns all {@link Links} for the given object.
30 | *
31 | * @param object must not be {@literal null}.
32 | * @return
33 | */
34 | Links getLinksFor(Object object);
35 |
36 | /**
37 | * Returns all {@link Links} for the given object and already existing {@link Link}.
38 | *
39 | * @param object must not be {@literal null}.
40 | * @param existing must not be {@literal null}.
41 | * @return
42 | */
43 | Links getLinksFor(Object object, Links existing);
44 |
45 | Links getLinksForNested(Object object, Links existing);
46 | }
47 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/package-info.java:
--------------------------------------------------------------------------------
1 | @org.springframework.lang.NonNullApi
2 | package org.springframework.data.rest.webmvc;
3 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/BackendId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.support;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Annotation to bind the backend id of an entity.
25 | *
26 | * @author Oliver Gierke
27 | */
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Target(ElementType.PARAMETER)
30 | public @interface BackendId {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/ConstraintViolationExceptionMessage.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc.support;
2 |
3 | import jakarta.validation.ConstraintViolation;
4 | import jakarta.validation.ConstraintViolationException;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import java.util.Locale;
9 |
10 | import org.springframework.context.MessageSource;
11 |
12 | import com.fasterxml.jackson.annotation.JsonProperty;
13 |
14 | /**
15 | * @author Jon Brisbin
16 | */
17 | public class ConstraintViolationExceptionMessage {
18 |
19 | private final ConstraintViolationException cve;
20 | private final List messages = new ArrayList();
21 |
22 | public ConstraintViolationExceptionMessage(ConstraintViolationException cve, MessageSource msgSrc, Locale locale) {
23 | this.cve = cve;
24 | for (ConstraintViolation> cv : cve.getConstraintViolations()) {
25 | messages.add(new ConstraintViolationMessage(cv, msgSrc, locale));
26 | }
27 | }
28 |
29 | @JsonProperty("cause")
30 | public String getCause() {
31 | return cve.getMessage();
32 | }
33 |
34 | @JsonProperty("messages")
35 | public List getMessages() {
36 | return messages;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/ConstraintViolationMessage.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc.support;
2 |
3 | import static java.lang.String.*;
4 |
5 | import jakarta.validation.ConstraintViolation;
6 |
7 | import java.util.Locale;
8 |
9 | import org.springframework.context.MessageSource;
10 |
11 | import com.fasterxml.jackson.annotation.JsonProperty;
12 |
13 | /**
14 | * A helper class to encapsulate {@link ConstraintViolation} errors.
15 | *
16 | * @author Jon Brisbin
17 | */
18 | public class ConstraintViolationMessage {
19 |
20 | private final ConstraintViolation> violation;
21 | private final String message;
22 |
23 | public ConstraintViolationMessage(ConstraintViolation> violation, MessageSource msgSrc, Locale locale) {
24 | this.violation = violation;
25 | this.message = msgSrc.getMessage(violation.getMessageTemplate(),
26 | new Object[] { violation.getLeafBean().getClass().getSimpleName(), violation.getPropertyPath().toString(),
27 | violation.getInvalidValue() },
28 | violation.getMessage(), locale);
29 | }
30 |
31 | @JsonProperty("entity")
32 | public String getEntity() {
33 | return violation.getRootBean().getClass().getName();
34 | }
35 |
36 | @JsonProperty("message")
37 | public String getMessage() {
38 | return message;
39 | }
40 |
41 | @JsonProperty("invalidValue")
42 | public String getInvalidValue() {
43 | return format("%s", violation.getInvalidValue());
44 | }
45 |
46 | @JsonProperty("property")
47 | public String getProperty() {
48 | return violation.getPropertyPath().toString();
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/ExceptionMessage.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc.support;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | /**
6 | * A helper that renders an {@link Exception} JSON-friendly.
7 | *
8 | * @author Jon Brisbin
9 | */
10 | public class ExceptionMessage {
11 |
12 | private final Throwable throwable;
13 |
14 | public ExceptionMessage(Throwable throwable) {
15 | this.throwable = throwable;
16 | }
17 |
18 | @JsonProperty("message")
19 | public String getMessage() {
20 | return throwable.getMessage();
21 | }
22 |
23 | @JsonProperty("cause")
24 | public ExceptionMessage getCause() {
25 | return throwable.getCause() != null ? new ExceptionMessage(throwable.getCause()) : null;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/ExcerptProjector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.support;
17 |
18 | /**
19 | * Interface for a component that can provide excerpt projections.
20 | *
21 | * @author Oliver Gierke
22 | * @since 2.5
23 | */
24 | public interface ExcerptProjector {
25 |
26 | /**
27 | * Creates a excerpt projection for the given source. If no excerpt projection is available, the object will be
28 | * returned as is. If you completely wish to skip handling the object, check for the presence of an excerpt projection
29 | * using {@link #hasExcerptProjection(Class)}.
30 | *
31 | * @param source must not be {@literal null}.
32 | * @return
33 | */
34 | Object projectExcerpt(Object source);
35 |
36 | /**
37 | * Returns whether an excerpt projection has been registered for the given type.
38 | *
39 | * @param type must not be {@literal null}.
40 | * @return
41 | */
42 | boolean hasExcerptProjection(Class> type);
43 | }
44 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/JpaHelper.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc.support;
2 |
3 | import jakarta.persistence.EntityManagerFactory;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import org.springframework.beans.BeansException;
9 | import org.springframework.beans.factory.BeanFactory;
10 | import org.springframework.beans.factory.BeanFactoryAware;
11 | import org.springframework.beans.factory.BeanFactoryUtils;
12 | import org.springframework.beans.factory.ListableBeanFactory;
13 | import org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor;
14 | import org.springframework.web.context.request.WebRequestInterceptor;
15 |
16 | /**
17 | * @author Jon Brisbin
18 | */
19 | public class JpaHelper implements BeanFactoryAware {
20 |
21 | private List interceptor = new ArrayList();
22 |
23 | @Override
24 | public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
25 | String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors((ListableBeanFactory) beanFactory,
26 | EntityManagerFactory.class);
27 | for (String s : beanNames) {
28 | EntityManagerFactory emf = (EntityManagerFactory) beanFactory.getBean(s);
29 | OpenEntityManagerInViewInterceptor omivi = new OpenEntityManagerInViewInterceptor();
30 | omivi.setEntityManagerFactory(emf);
31 | interceptor.add(omivi);
32 | }
33 | }
34 |
35 | public List getInterceptors() {
36 | return interceptor;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/Projector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.support;
17 |
18 | /**
19 | * Interface for a component being able to create projections for objects.
20 | *
21 | * @author Oliver Gierke
22 | */
23 | public interface Projector extends ExcerptProjector {
24 |
25 | /**
26 | * Returns the projection object for the given source. This may result in the same object being returned or a
27 | * completely different acting as projection for the source.
28 | *
29 | * @param source must not be {@literal null}.
30 | * @return
31 | */
32 | Object project(Object source);
33 | }
34 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/resources/META-INF/spring/aot.factories:
--------------------------------------------------------------------------------
1 | org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\
2 | org.springframework.data.rest.webmvc.aot.BasePathAwareControllerAotProcessor,\
3 | org.springframework.data.rest.webmvc.aot.ProjectionProxyAotProcessor
4 | org.springframework.aot.hint.RuntimeHintsRegistrar=\
5 | org.springframework.data.rest.webmvc.aot.ValueInstantiatorCustomizerRuntimeHints,\
6 | org.springframework.data.rest.webmvc.aot.RestMessagesResourcesRuntimeHints
7 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/main/resources/rest-default-messages.properties:
--------------------------------------------------------------------------------
1 | rest.description.pagination.page.description=The page to return.
2 | rest.description.pagination.size.description=The size of the page to return.
3 | rest.description.pagination.sort.description=The sorting criteria to use to calculate the content of the page.
4 | rest.description.projection=The projection that shall be applied when rendering the response. Acceptable values available in nested descriptors.
5 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchesResourceUnitTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2022 original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | /**
23 | * Unit tests for {@link RepositorySearchesResource}
24 | *
25 | * @author Oliver Gierke
26 | * @soundtrack Bakkushan - Gefahr (Bakkushan)
27 | */
28 | class RepositorySearchesResourceUnitTests {
29 |
30 | @Test // DATAREST-515
31 | void rejectsNullDomainType() {
32 |
33 | assertThatIllegalArgumentException() //
34 | .isThrownBy(() -> new RepositorySearchesResource(null));
35 | }
36 |
37 | @Test // DATAREST-515
38 | void returnsConfiguredDomainType() {
39 | assertThat(new RepositorySearchesResource(String.class).getDomainType()).isAssignableFrom(String.class);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/Requests.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc;
2 |
3 | import org.springframework.mock.web.MockHttpServletRequest;
4 |
5 | /**
6 | * @author Jon Brisbin
7 | */
8 | public abstract class Requests {
9 |
10 | public static MockHttpServletRequest ROOT_REQUEST = new MockHttpServletRequest("GET", "http://localhost:8080/");
11 | public static MockHttpServletRequest PAGE_REQUEST = new MockHttpServletRequest("GET", "http://localhost:8080/");
12 |
13 | static {
14 | PAGE_REQUEST.setParameter("page", "2");
15 | PAGE_REQUEST.setParameter("size", "10");
16 | }
17 |
18 | private Requests() {}
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ValidationErrors.properties:
--------------------------------------------------------------------------------
1 | field.name.required = Field {0}.{1} is required.
2 | no.userid = {0}s must be assigned initial userids.
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/JsonSchemaUnitTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2022 original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.junit.jupiter.api.Test;
21 | import org.springframework.data.rest.webmvc.json.JsonSchema.JsonSchemaProperty;
22 | import org.springframework.data.util.TypeInformation;
23 |
24 | /**
25 | * Unit tests for {@link JsonSchema}.
26 | *
27 | * @author Oliver Gierke
28 | */
29 | class JsonSchemaUnitTests {
30 |
31 | static final TypeInformation> type = TypeInformation.of(Sample.class);
32 |
33 | @Test // DATAREST-492
34 | void considersNumberPrimitivesJsonSchemaNumbers() {
35 |
36 | JsonSchemaProperty property = new JsonSchemaProperty("foo", null, "bar", false);
37 |
38 | assertThat(property.with(type.getRequiredProperty("foo")).type).isEqualTo("number");
39 | }
40 |
41 | static class Sample {
42 | double foo;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/patch/TodoList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json.patch;
17 |
18 | import java.io.Serializable;
19 | import java.util.List;
20 |
21 | class TodoList implements Serializable {
22 |
23 | private static final long serialVersionUID = 1L;
24 |
25 | private List todos;
26 | private Todo[] todoArray;
27 | private String name;
28 |
29 | public List getTodos() {
30 | return this.todos;
31 | }
32 |
33 | public Todo[] getTodoArray() {
34 | return this.todoArray;
35 | }
36 |
37 | public String getName() {
38 | return this.name;
39 | }
40 |
41 | public void setTodos(List todos) {
42 | this.todos = todos;
43 | }
44 |
45 | public void setTodoArray(Todo[] todoArray) {
46 | this.todoArray = todoArray;
47 | }
48 |
49 | public void setName(String name) {
50 | this.name = name;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/patch/TodoType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2025 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.json.patch;
17 |
18 | import org.springframework.util.ObjectUtils;
19 |
20 | /**
21 | * @author Mathias Düsterhöft
22 | * @author Oliver Gierke
23 | */
24 | class TodoType {
25 | private String value = "none";
26 |
27 | public TodoType(String value) {
28 | this.value = value;
29 | }
30 |
31 | public TodoType() {}
32 |
33 | public String getValue() {
34 | return this.value;
35 | }
36 |
37 | public void setValue(String value) {
38 | this.value = value;
39 | }
40 |
41 | @Override
42 | public boolean equals(Object o) {
43 | if (this == o)
44 | return true;
45 | if (o == null || getClass() != o.getClass())
46 | return false;
47 |
48 | TodoType todoType = (TodoType) o;
49 |
50 | return ObjectUtils.nullSafeEquals(value, todoType.value);
51 | }
52 |
53 | @Override
54 | public int hashCode() {
55 | return ObjectUtils.nullSafeHashCode(value);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ETagDoesntMatchExceptionUnitTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2022 original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.rest.webmvc.support;
17 |
18 | import static org.assertj.core.api.Assertions.*;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | /**
23 | * Unit tests for {@link ETagDoesntMatchException}.
24 | *
25 | * @author Oliver Gierke
26 | */
27 | class ETagDoesntMatchExceptionUnitTests {
28 |
29 | @Test // DATAREST-160
30 | void rejectsNullTargetBean() {
31 |
32 | assertThatIllegalArgumentException() //
33 | .isThrownBy(() -> new ETagDoesntMatchException(null, ETag.from("1")));
34 | }
35 |
36 | @Test // DATAREST-160
37 | void rejectsNullExpectedETag() {
38 |
39 | assertThatIllegalArgumentException() //
40 | .isThrownBy(() -> new ETagDoesntMatchException(new Object(), null));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/AssertionUtils.java:
--------------------------------------------------------------------------------
1 | package org.springframework.data.rest.webmvc.util;
2 |
3 | import java.util.function.Predicate;
4 |
5 | /**
6 | * Various extensions of AssertJ to improve testing.
7 | *
8 | * @author Greg Turnquist
9 | */
10 | public final class AssertionUtils {
11 |
12 | /**
13 | * {@link Predicate} to verify a given string ends in a certain suffix.
14 | *
15 | * @param suffix
16 | * @return
17 | */
18 | public static Predicate suffix(String suffix) {
19 | return s -> s.endsWith(suffix);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d %5p %40.40c:%4L - %m%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-array.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"replace", "path":"/items", "value": ["one","two","three"]}
3 | ]
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-biginteger.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"replace", "path":"/amount", "value": 18446744073709551616 }
3 | ]
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-failing-operation-first.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"test", "path":"/5/description", "value":"A"},
3 | {"op":"remove", "path":"/5"},
4 | {"op":"replace", "path":"/1/complete", "value":true},
5 | {"op":"copy", "path":"/3/description", "from":"/2/description"},
6 | {"op":"copy", "path":"/4", "from":"/0"}
7 | ]
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-failing-operation-in-middle.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"test", "path":"/5/description", "value":"A"},
3 | {"op":"remove", "path":"/5"},
4 | {"op":"replace", "path":"/1/complete", "value":true},
5 | {"op":"test", "path":"/0/description", "value":"HUH"},
6 | {"op":"copy", "path":"/3/description", "from":"/2/description"},
7 | {"op":"copy", "path":"/4", "from":"/0"}
8 | ]
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-failing-with-invalid-content.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"add", "path":"/description", "value": { "content" : "blabla"}}
3 | ]
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-invalid-path.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"replace", "path":"/somethingInvalid", "value": "bar" }
3 | ]
4 |
--------------------------------------------------------------------------------
/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/json/patch/patch-many-successful-operations.json:
--------------------------------------------------------------------------------
1 | [
2 | {"op":"test", "path":"/0", "value":{"id":1,"description":"A","complete":true}},
3 | {"op":"test", "path":"/5/description", "value":"F"},
4 | {"op":"remove", "path":"/5"},
5 | {"op":"replace", "path":"/1/complete", "value":true},
6 | {"op":"copy", "path":"/3/description", "from":"/2/description"},
7 | {"op":"copy", "path":"/4", "from":"/0"}
8 | ]
--------------------------------------------------------------------------------
/src/main/antora/antora-playbook.yml:
--------------------------------------------------------------------------------
1 | # PACKAGES antora@3.2.0-alpha.2 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.1.0-alpha.2 @asciidoctor/tabs@1.0.0-alpha.12 @opendevise/antora-release-line-extension@1.0.0-alpha.2
2 | #
3 | # The purpose of this Antora playbook is to build the docs in the current branch.
4 | antora:
5 | extensions:
6 | - require: '@springio/antora-extensions'
7 | root_component_name: 'data-rest'
8 | site:
9 | title: Spring Data REST
10 | url: https://docs.spring.io/spring-data-rest/reference/
11 | content:
12 | sources:
13 | - url: ./../../..
14 | branches: HEAD
15 | start_path: src/main/antora
16 | worktrees: true
17 | asciidoc:
18 | attributes:
19 | hide-uri-scheme: '@'
20 | tabs-sync-option: '@'
21 | extensions:
22 | - '@asciidoctor/tabs'
23 | - '@springio/asciidoctor-extensions'
24 | - '@springio/asciidoctor-extensions/javadoc-extension'
25 | sourcemap: true
26 | urls:
27 | latest_version_segment: ''
28 | runtime:
29 | log:
30 | failure_level: warn
31 | format: pretty
32 | ui:
33 | bundle:
34 | url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
35 | snapshot: true
36 |
--------------------------------------------------------------------------------
/src/main/antora/antora.yml:
--------------------------------------------------------------------------------
1 | name: data-rest
2 | version: true
3 | title: Spring Data REST
4 | nav:
5 | - modules/ROOT/nav.adoc
6 | ext:
7 | collector:
8 | - run:
9 | command: ./mvnw validate process-resources -pl :spring-data-rest-distribution -am -Pantora-process-resources
10 | local: true
11 | scan:
12 | dir: spring-data-rest-distribution/target/classes/
13 | - run:
14 | command: ./mvnw package -Pdistribute
15 | local: true
16 | scan:
17 | dir: target/antora
18 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/examples/mongodb:
--------------------------------------------------------------------------------
1 | ../../../../../../spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/examples/security:
--------------------------------------------------------------------------------
1 | ../../../../../../spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/examples/support:
--------------------------------------------------------------------------------
1 | ../../../../../../spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/images/hal-explorer-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/antora/modules/ROOT/images/hal-explorer-1.png
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/images/hal-explorer-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/antora/modules/ROOT/images/hal-explorer-2.png
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/images/hal-explorer-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/antora/modules/ROOT/images/hal-explorer-3.png
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/nav.adoc:
--------------------------------------------------------------------------------
1 | * xref:index.adoc[]
2 |
3 | * xref:intro.adoc[]
4 | ** xref:introduction/upgrade.adoc[]
5 | ** xref:introduction/getting-started.adoc[]
6 | ** xref:introduction/example-api-usage-with-curl.adoc[]
7 | ** xref:introduction/spring-data-rest-examples.adoc[]
8 |
9 | * xref:repository-resources.adoc[]
10 | ** xref:paging-and-sorting.adoc[]
11 | ** xref:projections-excerpts.adoc[]
12 |
13 | * xref:representations.adoc[Representations]
14 | * xref:etags-and-other-conditionals.adoc[Conditional Operations]
15 | * xref:validation.adoc[]
16 | * xref:events.adoc[]
17 | * xref:integration.adoc[]
18 | * xref:metadata.adoc[]
19 | * xref:security.adoc[]
20 | * xref:tools.adoc[]
21 |
22 | * xref:customizing-sdr.adoc[]
23 | ** xref:customizing/configuring-the-rest-url-path.adoc[]
24 | ** xref:customizing/adding-sdr-to-spring-mvc-app.adoc[]
25 | ** xref:customizing/overriding-sdr-response-handlers.adoc[]
26 | ** xref:customizing/customizing-json-output.adoc[]
27 | ** xref:customizing/custom-jackson-deserialization.adoc[]
28 | ** xref:customizing/configuring-cors.adoc[]
29 |
30 | * xref:attachment$api/java/index.html[Javadoc,role=link-external,window=_blank]
31 | * https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external,window=_blank]
32 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/index.adoc:
--------------------------------------------------------------------------------
1 | [[spring-data-rest-reference-documentation]]
2 | = Spring Data REST
3 | :feature-scroll: true
4 |
5 | _Spring Data REST exports Spring Data repositories as REST resources through WebMVC.
6 | It eases development of applications with a consistent programming model backed by Spring Data modules sources._
7 |
8 | [horizontal]
9 | xref:intro.adoc[Introduction] :: Introduction to Spring Data REST and Examples
10 | xref:repository-resources.adoc[Repository Resources] :: Exporting Repositories as REST Resources
11 | xref:representations.adoc[Representations] :: Domain Object Representations (Object Mapping)
12 | xref:etags-and-other-conditionals.adoc[Conditionals] :: Conditional Operations with ETag and other Headers
13 | xref:validation.adoc[Validation] :: Validator Integration
14 | xref:events.adoc[Events] :: Listening to REST Events
15 | xref:integration.adoc[Integration] :: Integration with Spring Data REST components
16 | xref:metadata.adoc[Metadata] :: ALPS and JSON Schema
17 | xref:security.adoc[Security] :: Spring Security Integration
18 | xref:tools.adoc[Tools] :: HAL Explorer
19 | xref:customizing-sdr.adoc[Customizing] :: Tutorials and Recipes to customize Spring Data REST
20 | https://github.com/spring-projects/spring-data-commons/wiki[Wiki] :: What's New,
21 | Upgrade Notes, Supported Versions, additional cross-version information.
22 |
23 | Jon Brisbin, Oliver Drotbohm, Greg Turnquist, Jay Bryant
24 |
25 | (C) 2008-2025 VMware, Inc.
26 |
27 | 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.
28 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/intro.adoc:
--------------------------------------------------------------------------------
1 | [[intro-chapter]]
2 | = Introduction
3 | :page-section-summary-toc: 1
4 |
5 | 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.
6 |
7 | 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.
8 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/introduction/example-api-usage-with-curl.adoc:
--------------------------------------------------------------------------------
1 | [[example-api-usage-with-curl]]
2 | [appendix]
3 | [[using-curl-to-talk-to-spring-data-rest]]
4 | = Using cURL to talk to Spring Data REST
5 | :page-section-summary-toc: 1
6 |
7 | This appendix contains a list of guides that demonstrate interacting with a Spring Data REST service over cURL:
8 |
9 | * https://spring.io/guides/gs/accessing-data-rest/[Accessing JPA Data with REST]
10 | * https://spring.io/guides/gs/accessing-neo4j-data-rest/[Accessing Neo4j Data with REST]
11 | * https://spring.io/guides/gs/accessing-mongodb-data-rest/[Accessing MongoDB Data with REST]
12 | * https://spring.io/guides/gs/accessing-gemfire-data-rest/[Accessing GemFire Data with REST]
13 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/introduction/upgrade.adoc:
--------------------------------------------------------------------------------
1 | [[new-features]]
2 | [[upgrading]]
3 | = Upgrading Spring Data
4 |
5 | Instructions for how to upgrade from earlier versions of Spring Data are provided on the project https://github.com/spring-projects/spring-data-commons/wiki[wiki].
6 | Follow the links in the https://github.com/spring-projects/spring-data-commons/wiki#release-notes[release notes section] to find the version that you want to upgrade to.
7 |
8 | Upgrading instructions are always the first item in the release notes. If you are more than one release behind, please make sure that you also review the release notes of the versions that you jumped.
9 |
--------------------------------------------------------------------------------
/src/main/antora/modules/ROOT/pages/validation.adoc:
--------------------------------------------------------------------------------
1 | [[validation]]
2 | = Validation
3 |
4 | There are two ways to register a `Validator` instance in Spring Data REST: wire it by bean name or register the validator manually. For the majority of cases, the simple bean name prefix style is sufficient.
5 |
6 | In order to tell Spring Data REST you want a particular `Validator` assigned to a particular event, prefix the bean name with the event in question. For example, to validate instances of the `Person` class before new ones are saved into the repository, you would declare an instance of a `Validator` in your `ApplicationContext` with a bean name of `beforeCreatePersonValidator`. Since the `beforeCreate` prefix matches a known Spring Data REST event, that validator is wired to the correct event.
7 |
8 | [[validation.assigning-validators]]
9 | == Assigning Validators Manually
10 |
11 | If you would rather not use the bean name prefix approach, you need to register an instance of your validator with the bean whose job it is to invoke validators after the correct event. In your configuration that implements `RepositoryRestConfigurer`, override the `configureValidatingRepositoryEventListener` method and call `addValidator` on the `ValidatingRepositoryEventListener`, passing the event on which you want this validator to be triggered and an instance of the validator. The following example shows how to do so:
12 |
13 | ====
14 | [source,java]
15 | ----
16 | @Override
17 | void configureValidatingRepositoryEventListener(ValidatingRepositoryEventListener v) {
18 | v.addValidator("beforeSave", new BeforeSaveValidator());
19 | }
20 | ----
21 | ====
22 |
--------------------------------------------------------------------------------
/src/main/antora/resources/antora-resources/antora.yml:
--------------------------------------------------------------------------------
1 | version: ${antora-component.version}
2 | prerelease: ${antora-component.prerelease}
3 |
4 | asciidoc:
5 | attributes:
6 | version: ${project.version}
7 | springversionshort: ${spring.short}
8 | springversion: ${spring}
9 | attribute-missing: 'warn'
10 | commons: ${springdata.commons.docs}
11 | include-xml-namespaces: false
12 | spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference
13 | spring-data-commons-javadoc-base: https://docs.spring.io/spring-data/commons/docs/${springdata.commons}/api/
14 | springdocsurl: https://docs.spring.io/spring-framework/reference/{springversionshort}
15 | springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api
16 | spring-framework-docs: '{springdocsurl}'
17 | spring-framework-javadoc: '{springjavadocurl}'
18 | springhateoasversion: ${spring-hateoas}
19 | releasetrainversion: ${releasetrain}
20 |
--------------------------------------------------------------------------------
/src/main/asciidoc/images/epub-cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/asciidoc/images/epub-cover.png
--------------------------------------------------------------------------------
/src/main/asciidoc/images/hal-explorer-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/asciidoc/images/hal-explorer-1.png
--------------------------------------------------------------------------------
/src/main/asciidoc/images/hal-explorer-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/asciidoc/images/hal-explorer-2.png
--------------------------------------------------------------------------------
/src/main/asciidoc/images/hal-explorer-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-projects/spring-data-rest/a6889a70e4d6623d7398f99cc987b9036250bedc/src/main/asciidoc/images/hal-explorer-3.png
--------------------------------------------------------------------------------
/src/main/resources/notice.txt:
--------------------------------------------------------------------------------
1 | Spring Data REST 5.0 M3 (2025.1.0)
2 | Copyright (c) 2012-2019 Pivotal Software, Inc.
3 |
4 | This product is licensed to you under the Apache License, Version 2.0
5 | (the "License"). You may not use this product except in compliance with
6 | the License.
7 |
8 | This product may include a number of subcomponents with separate
9 | copyright notices and license terms. Your use of the source code for
10 | these subcomponents is subject to the terms and conditions of the
11 | subcomponent's license, as noted in the license.txt file.
12 |
13 |
--------------------------------------------------------------------------------