Workaround for spring-framework#21094

This commit is contained in:
Philippe 2019-04-01 22:22:02 -03:00
parent 29d9159ebf
commit a86c69429b
3 changed files with 87 additions and 52 deletions

View File

@ -1,62 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung.spring</groupId> <groupId>org.baeldung.spring</groupId>
<artifactId>spring-webflux-amqp</artifactId> <artifactId>spring-webflux-amqp</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<name>spring-webflux-amqp</name> <name>spring-webflux-amqp</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Spring WebFlux AMQP Sample</description> <description>Spring WebFlux AMQP Sample</description>
<parent> <parent>
<artifactId>parent-boot-2</artifactId> <artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath> <relativePath>../parent-boot-2</relativePath>
</parent> </parent>
<dependencies> <dependencyManagement>
<dependency> <dependencies>
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-starter-amqp</artifactId> <!-- Import dependency management from Spring Boot -->
</dependency> <groupId>org.springframework.boot</groupId>
<dependency> <artifactId>spring-boot-dependencies</artifactId>
<groupId>org.springframework.boot</groupId> <!-- <version>2.0.4.RELEASE</version> --><!-- works -->
<artifactId>spring-boot-starter-webflux</artifactId> <version>2.1.3.RELEASE</version> <!-- Works with workaround applied -->
</dependency> <type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency> <dependencies>
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-configuration-processor</artifactId> <groupId>org.springframework.boot</groupId>
<optional>true</optional> <artifactId>spring-boot-starter-amqp</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<scope>test</scope> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.projectreactor</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>reactor-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>io.projectreactor</groupId>
<artifactId>spring-boot-starter-integration</artifactId> <artifactId>reactor-test</artifactId>
</dependency> <scope>test</scope>
</dependencies> </dependency>
<build> <dependency>
<plugins> <groupId>org.springframework.boot</groupId>
<plugin> <artifactId>spring-boot-starter-integration</artifactId>
<groupId>org.springframework.boot</groupId> </dependency>
<artifactId>spring-boot-maven-plugin</artifactId> </dependencies>
</plugin>
</plugins> <build>
</build> <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -3,6 +3,12 @@ package org.baeldung.spring.amqp;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.reactive.HiddenHttpMethodFilter;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
@SpringBootApplication @SpringBootApplication
@EnableConfigurationProperties(DestinationsConfig.class) @EnableConfigurationProperties(DestinationsConfig.class)
@ -12,4 +18,19 @@ public class SpringWebfluxAmqpApplication {
SpringApplication.run(SpringWebfluxAmqpApplication.class, args); SpringApplication.run(SpringWebfluxAmqpApplication.class, args);
} }
/**
* This is a workaround for https://github.com/spring-projects/spring-framework/issues/21094
* @return
*/
@Bean
public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
return new HiddenHttpMethodFilter() {
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
return chain.filter(exchange);
}
};
}
} }

View File

@ -1,6 +1,6 @@
spring: spring:
rabbitmq: rabbitmq:
host: localhost host: 192.168.99.100
port: 5672 port: 5672
username: guest username: guest
password: guest password: guest