Skip to content

Commit 9e55af1

Browse files
gregturnodrotbohm
authored andcommitted
#728 - Add support for Spring WebFlux.
* Render hypermedia from WebFlux controllers. * Support consuming hypermedia through WebClient. * Support link creation reactively with a custom filter and explicitly with a user-provided ServerWebExchange. * Add a ReactiveResourceAssembler and SimpleReactiveResourceAssembler. * Upgrade to Spring Framework 5.2 to align with Spring Data Moore, removing specialized Forwarded header handling.
1 parent 544d7cd commit 9e55af1

File tree

45 files changed

+3005
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3005
-544
lines changed

pom.xml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
hyper-text driven REST web services.
1414
</description>
1515

16-
<inceptionYear>2012-2018</inceptionYear>
16+
<inceptionYear>2012-2019</inceptionYear>
1717

1818
<organization>
1919
<name>Pivotal, Inc.</name>
@@ -48,7 +48,7 @@
4848
<name>Apache License, Version 2.0</name>
4949
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
5050
<comments>
51-
Copyright 2011-2018 the original author or authors.
51+
Copyright 2011-2019 the original author or authors.
5252

5353
Licensed under the Apache License, Version 2.0 (the "License");
5454
you may not use this file except in compliance with the License.
@@ -77,6 +77,7 @@
7777
<java-module-name>spring.hateoas</java-module-name>
7878
<jsonpath.version>2.2.0</jsonpath.version>
7979
<minidevjson.version>2.2.1</minidevjson.version>
80+
<reactor-bom.version>Californium-SR4</reactor-bom.version>
8081
<slf4j.version>1.7.25</slf4j.version>
8182
<spring.version>5.1.5.RELEASE</spring.version>
8283
<spring-plugin.version>2.0.0.BUILD-SNAPSHOT</spring-plugin.version>
@@ -434,6 +435,18 @@
434435

435436
</profiles>
436437

438+
<dependencyManagement>
439+
<dependencies>
440+
<dependency>
441+
<groupId>io.projectreactor</groupId>
442+
<artifactId>reactor-bom</artifactId>
443+
<version>${reactor-bom.version}</version>
444+
<scope>import</scope>
445+
<type>pom</type>
446+
</dependency>
447+
</dependencies>
448+
</dependencyManagement>
449+
437450
<dependencies>
438451

439452
<!-- Kotlin extension -->
@@ -490,6 +503,14 @@
490503
<groupId>org.springframework</groupId>
491504
<artifactId>spring-webmvc</artifactId>
492505
<version>${spring.version}</version>
506+
<optional>true</optional>
507+
</dependency>
508+
509+
<dependency>
510+
<groupId>org.springframework</groupId>
511+
<artifactId>spring-webflux</artifactId>
512+
<version>${spring.version}</version>
513+
<optional>true</optional>
493514
</dependency>
494515

495516
<dependency>
@@ -595,6 +616,24 @@
595616
<scope>test</scope>
596617
</dependency>
597618

619+
<dependency>
620+
<groupId>io.projectreactor.netty</groupId>
621+
<artifactId>reactor-netty</artifactId>
622+
<scope>test</scope>
623+
</dependency>
624+
625+
<dependency>
626+
<groupId>io.projectreactor</groupId>
627+
<artifactId>reactor-test</artifactId>
628+
<scope>test</scope>
629+
</dependency>
630+
631+
<dependency>
632+
<groupId>io.projectreactor.addons</groupId>
633+
<artifactId>reactor-extra</artifactId>
634+
<scope>test</scope>
635+
</dependency>
636+
598637
<!-- Needs to be after Jadler to make sure it sees the Servlet 3.0 dependency pulled in for testing -->
599638

600639
<dependency>

src/main/java/org/springframework/hateoas/ResourceSupport.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,6 +41,22 @@ public ResourceSupport() {
4141
this.links = new ArrayList<>();
4242
}
4343

44+
public ResourceSupport(Link initialLink) {
45+
46+
Assert.notNull(initialLink, "initialLink must not be null!");
47+
48+
this.links = new ArrayList<>();
49+
this.links.add(initialLink);
50+
}
51+
52+
public ResourceSupport(List<Link> initialLinks) {
53+
54+
Assert.notNull(initialLinks, "initialLinks must not be null!");
55+
56+
this.links = new ArrayList<>();
57+
this.links.addAll(initialLinks);
58+
}
59+
4460
/**
4561
* Returns the {@link Link} with a rel of {@link IanaLinkRelations#SELF}.
4662
*/

src/main/java/org/springframework/hateoas/config/ConverterRegisteringWebMvcConfigurer.java

Lines changed: 0 additions & 207 deletions
This file was deleted.

src/main/java/org/springframework/hateoas/config/HateoasConfiguration.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2018 the original author or authors.
2+
* Copyright 2015-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616
package org.springframework.hateoas.config;
1717

1818
import org.springframework.beans.factory.BeanCreationException;
19-
import org.springframework.beans.factory.ObjectFactory;
2019
import org.springframework.context.annotation.Bean;
2120
import org.springframework.context.annotation.Configuration;
2221
import org.springframework.context.annotation.Primary;
@@ -39,6 +38,7 @@
3938
* Common HATEOAS specific configuration.
4039
*
4140
* @author Oliver Gierke
41+
* @author Greg Turnquist
4242
* @soundtrack Elephants Crossing - Wait (Live at Stadtfest Dresden)
4343
* @since 0.19
4444
*/
@@ -66,12 +66,6 @@ public MessageSourceAccessor linkRelationMessageSource() {
6666
}
6767
}
6868

69-
@Bean
70-
ConverterRegisteringBeanPostProcessor jackson2ModuleRegisteringBeanPostProcessor(
71-
ObjectFactory<ConverterRegisteringWebMvcConfigurer> configurer) {
72-
return new ConverterRegisteringBeanPostProcessor(configurer);
73-
}
74-
7569
// RelProvider
7670

7771
@Bean

0 commit comments

Comments
 (0)