|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2018 the original author or authors. |
| 2 | + * Copyright 2012-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
24 | 24 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
25 | 25 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
26 | 26 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
| 27 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; |
| 28 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; |
| 29 | +import org.springframework.boot.autoconfigure.condition.NoneNestedConditions; |
27 | 30 | import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
| 31 | +import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration.NotReactiveWebApplicationCondition; |
28 | 32 | import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
29 | 33 | import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
|
30 | 34 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
31 | 35 | import org.springframework.context.annotation.Bean;
|
| 36 | +import org.springframework.context.annotation.Conditional; |
32 | 37 | import org.springframework.context.annotation.Configuration;
|
33 | 38 | import org.springframework.context.annotation.Import;
|
34 | 39 | import org.springframework.http.converter.HttpMessageConverter;
|
|
49 | 54 | */
|
50 | 55 | @Configuration
|
51 | 56 | @ConditionalOnClass(HttpMessageConverter.class)
|
| 57 | +@Conditional(NotReactiveWebApplicationCondition.class) |
52 | 58 | @AutoConfigureAfter({ GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
|
53 | 59 | JsonbAutoConfiguration.class })
|
54 | 60 | @Import({ JacksonHttpMessageConvertersConfiguration.class,
|
@@ -93,4 +99,17 @@ public StringHttpMessageConverter stringHttpMessageConverter() {
|
93 | 99 |
|
94 | 100 | }
|
95 | 101 |
|
| 102 | + static class NotReactiveWebApplicationCondition extends NoneNestedConditions { |
| 103 | + |
| 104 | + NotReactiveWebApplicationCondition() { |
| 105 | + super(ConfigurationPhase.PARSE_CONFIGURATION); |
| 106 | + } |
| 107 | + |
| 108 | + @ConditionalOnWebApplication(type = Type.REACTIVE) |
| 109 | + private static class ReactiveWebApplication { |
| 110 | + |
| 111 | + } |
| 112 | + |
| 113 | + } |
| 114 | + |
96 | 115 | }
|
0 commit comments