#1244 - Polishing.

Added missing license headers and a bit of formatting. Nullability annotations in HypermediaWebTestClientConfigurer.
This commit is contained in:
Oliver Drotbohm
2020-03-31 13:52:05 +02:00
parent 904a03a241
commit 14f6375234
3 changed files with 48 additions and 14 deletions

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.hateoas.config;
import org.springframework.web.client.RestTemplate;
@@ -12,11 +27,11 @@ public class HypermediaRestTemplateConfigurer {
private final WebConverters converters;
/**
* Creates a new {@link HypermediaRestTemplateConfigurer} using the {@link WebConverters}.
*
* @param converters
*/
/**
* Creates a new {@link HypermediaRestTemplateConfigurer} using the {@link WebConverters}.
*
* @param converters
*/
HypermediaRestTemplateConfigurer(WebConverters converters) {
this.converters = converters;
}

View File

@@ -15,19 +15,21 @@
*/
package org.springframework.hateoas.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.function.Consumer;
import org.springframework.http.client.reactive.ClientHttpConnector;
import org.springframework.http.codec.ClientCodecConfigurer;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.lang.Nullable;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClientConfigurer;
import org.springframework.util.Assert;
import org.springframework.util.MimeType;
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
import java.util.List;
import java.util.function.Consumer;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Assembles {@link Jackson2JsonEncoder}s and {@link Jackson2JsonDecoder}s needed to wire a {@link WebTestClient} with
@@ -67,8 +69,9 @@ public class HypermediaWebTestClientConfigurer implements WebTestClientConfigure
* {@link WebTestClient}.
*/
@Override
public void afterConfigurerAdded(WebTestClient.Builder builder, WebHttpHandlerBuilder webHttpHandlerBuilder,
ClientHttpConnector clientHttpConnector) {
public void afterConfigurerAdded(WebTestClient.Builder builder, //
@Nullable WebHttpHandlerBuilder webHttpHandlerBuilder, //
@Nullable ClientHttpConnector clientHttpConnector) {
builder.codecs(this.configurer);
}
}

View File

@@ -1,10 +1,27 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.hateoas.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.client.WebClient;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Assembles {@link ExchangeStrategies} needed to wire a {@link WebClient} with hypermedia support.
@@ -12,8 +29,7 @@ import java.util.List;
* @author Greg Turnquist
* @author Oliver Drotbohm
* @since 1.0
* @deprecated Migrate to {@link HypermediaWebClientConfigurer} and it's {@link WebClient.Builder}-oriented
* approach.
* @deprecated Migrate to {@link HypermediaWebClientConfigurer} and it's {@link WebClient.Builder}-oriented approach.
*/
@Deprecated
public class WebClientConfigurer {