pull/10948/merge
Phillip Webb 7 years ago
parent cf485ce144
commit f647f5689f

@ -52,8 +52,7 @@ public class ConditionsReportEndpoint {
private final ConditionEvaluationReport conditionEvaluationReport; private final ConditionEvaluationReport conditionEvaluationReport;
public ConditionsReportEndpoint( public ConditionsReportEndpoint(ConditionEvaluationReport conditionEvaluationReport) {
ConditionEvaluationReport conditionEvaluationReport) {
this.conditionEvaluationReport = conditionEvaluationReport; this.conditionEvaluationReport = conditionEvaluationReport;
} }

@ -34,8 +34,9 @@ import org.springframework.data.couchbase.repository.ReactiveCouchbaseRepository
* @since 2.0.0 * @since 2.0.0
*/ */
@Configuration @Configuration
@ConditionalOnClass({Bucket.class, ReactiveCouchbaseRepository.class, Flux.class}) @ConditionalOnClass({ Bucket.class, ReactiveCouchbaseRepository.class, Flux.class })
@AutoConfigureAfter(CouchbaseDataAutoConfiguration.class) @AutoConfigureAfter(CouchbaseDataAutoConfiguration.class)
@Import(SpringBootCouchbaseReactiveDataConfiguration.class) @Import(SpringBootCouchbaseReactiveDataConfiguration.class)
public class CouchbaseReactiveDataAutoConfiguration { public class CouchbaseReactiveDataAutoConfiguration {
} }

@ -31,14 +31,14 @@ import org.springframework.data.couchbase.repository.config.ReactiveRepositoryOp
import org.springframework.data.couchbase.repository.support.ReactiveCouchbaseRepositoryFactoryBean; import org.springframework.data.couchbase.repository.support.ReactiveCouchbaseRepositoryFactoryBean;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Couchbase * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Couchbase Reactive
* Reactive Repositories. * Repositories.
* *
* @author Alex Derkach * @author Alex Derkach
* @since 2.0.0 * @since 2.0.0
*/ */
@Configuration @Configuration
@ConditionalOnClass({Bucket.class, ReactiveCouchbaseRepository.class}) @ConditionalOnClass({ Bucket.class, ReactiveCouchbaseRepository.class })
@ConditionalOnProperty(prefix = "spring.data.couchbase.reactive-repositories", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.data.couchbase.reactive-repositories", name = "enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnBean(ReactiveRepositoryOperationsMapping.class) @ConditionalOnBean(ReactiveRepositoryOperationsMapping.class)
@ConditionalOnMissingBean(ReactiveCouchbaseRepositoryFactoryBean.class) @ConditionalOnMissingBean(ReactiveCouchbaseRepositoryFactoryBean.class)

@ -69,7 +69,8 @@ class SpringBootCouchbaseReactiveDataConfiguration
@Override @Override
@ConditionalOnMissingBean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING) @ConditionalOnMissingBean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING)
@Bean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING) @Bean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING)
public ReactiveRepositoryOperationsMapping reactiveRepositoryOperationsMapping(RxJavaCouchbaseTemplate reactiveCouchbaseTemplate) throws Exception { public ReactiveRepositoryOperationsMapping reactiveRepositoryOperationsMapping(
RxJavaCouchbaseTemplate reactiveCouchbaseTemplate) throws Exception {
return super.reactiveRepositoryOperationsMapping(reactiveCouchbaseTemplate); return super.reactiveRepositoryOperationsMapping(reactiveCouchbaseTemplate);
} }

@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.data.couchbase.city.City;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
public interface ReactiveCityCouchbaseRepository extends Repository<City, Long> { public interface ReactiveCityCouchbaseRepository extends Repository<City, Long> {
Mono<City> save(City city); Mono<City> save(City city);
Mono<City> findById(Long id); Mono<City> findById(Long id);

@ -73,7 +73,8 @@ public class CouchbaseReactiveDataAutoConfigurationTests {
@Test @Test
public void customConfiguration() { public void customConfiguration() {
load(CustomCouchbaseConfiguration.class); load(CustomCouchbaseConfiguration.class);
RxJavaCouchbaseTemplate rxJavaCouchbaseTemplate = this.context.getBean(RxJavaCouchbaseTemplate.class); RxJavaCouchbaseTemplate rxJavaCouchbaseTemplate = this.context
.getBean(RxJavaCouchbaseTemplate.class);
assertThat(rxJavaCouchbaseTemplate.getDefaultConsistency()) assertThat(rxJavaCouchbaseTemplate.getDefaultConsistency())
.isEqualTo(Consistency.STRONGLY_CONSISTENT); .isEqualTo(Consistency.STRONGLY_CONSISTENT);
} }
@ -81,8 +82,8 @@ public class CouchbaseReactiveDataAutoConfigurationTests {
@Test @Test
public void validatorIsPresent() { public void validatorIsPresent() {
load(CouchbaseTestConfigurer.class); load(CouchbaseTestConfigurer.class);
assertThat(this.context.getBeansOfType( assertThat(this.context.getBeansOfType(ValidatingCouchbaseEventListener.class))
ValidatingCouchbaseEventListener.class)).hasSize(1); .hasSize(1);
} }
@Test @Test
@ -99,8 +100,8 @@ public class CouchbaseReactiveDataAutoConfigurationTests {
@Test @Test
public void customConversions() { public void customConversions() {
load(CustomConversionsConfig.class); load(CustomConversionsConfig.class);
RxJavaCouchbaseTemplate template = this.context.getBean( RxJavaCouchbaseTemplate template = this.context
RxJavaCouchbaseTemplate.class); .getBean(RxJavaCouchbaseTemplate.class);
assertThat(template.getConverter().getConversionService() assertThat(template.getConverter().getConversionService()
.canConvert(CouchbaseProperties.class, Boolean.class)).isTrue(); .canConvert(CouchbaseProperties.class, Boolean.class)).isTrue();
} }
@ -113,13 +114,15 @@ public class CouchbaseReactiveDataAutoConfigurationTests {
} }
context.register(PropertyPlaceholderAutoConfiguration.class, context.register(PropertyPlaceholderAutoConfiguration.class,
ValidationAutoConfiguration.class, CouchbaseAutoConfiguration.class, ValidationAutoConfiguration.class, CouchbaseAutoConfiguration.class,
CouchbaseDataAutoConfiguration.class, CouchbaseReactiveDataAutoConfiguration.class); CouchbaseDataAutoConfiguration.class,
CouchbaseReactiveDataAutoConfiguration.class);
context.refresh(); context.refresh();
this.context = context; this.context = context;
} }
@Configuration @Configuration
static class CustomCouchbaseConfiguration extends AbstractReactiveCouchbaseDataConfiguration { static class CustomCouchbaseConfiguration
extends AbstractReactiveCouchbaseDataConfiguration {
@Override @Override
protected CouchbaseConfigurer couchbaseConfigurer() { protected CouchbaseConfigurer couchbaseConfigurer() {

@ -92,12 +92,10 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests {
context.register(config); context.register(config);
} }
context.register(PropertyPlaceholderAutoConfiguration.class, context.register(PropertyPlaceholderAutoConfiguration.class,
CouchbaseAutoConfiguration.class, CouchbaseAutoConfiguration.class, CouchbaseDataAutoConfiguration.class,
CouchbaseDataAutoConfiguration.class,
CouchbaseRepositoriesAutoConfiguration.class, CouchbaseRepositoriesAutoConfiguration.class,
CouchbaseReactiveDataAutoConfiguration.class, CouchbaseReactiveDataAutoConfiguration.class,
CouchbaseReactiveRepositoriesAutoConfiguration.class CouchbaseReactiveRepositoriesAutoConfiguration.class);
);
context.refresh(); context.refresh();
this.context = context; this.context = context;
} }
@ -122,4 +120,5 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests {
protected static class CustomizedConfiguration { protected static class CustomizedConfiguration {
} }
} }

@ -21,6 +21,7 @@ import reactor.core.publisher.Mono;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
public interface ReactiveCityRepository extends Repository<City, Long> { public interface ReactiveCityRepository extends Repository<City, Long> {
Mono<City> save(City city); Mono<City> save(City city);
Mono<City> findById(Long id); Mono<City> findById(Long id);

@ -728,6 +728,8 @@ In the preceding example, when `my.servers` is redefined in several places, the
the `PropertySource` with higher precedence will override any other configuration for that list. the `PropertySource` with higher precedence will override any other configuration for that list.
Both comma-separated lists and yaml lists can be used for completely overriding the contents of the list. Both comma-separated lists and yaml lists can be used for completely overriding the contents of the list.
[[boot-features-external-config-exposing-yaml-to-spring]] [[boot-features-external-config-exposing-yaml-to-spring]]
==== Exposing YAML as Properties in the Spring Environment ==== Exposing YAML as Properties in the Spring Environment
The `YamlPropertySourceLoader` class can be used to expose YAML as a `PropertySource` in The `YamlPropertySourceLoader` class can be used to expose YAML as a `PropertySource` in

@ -222,13 +222,6 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
postProcessContext(context); postProcessContext(context);
} }
private void configureTldSkipPatterns(TomcatEmbeddedContext context) {
StandardJarScanFilter filter = new StandardJarScanFilter();
filter.setTldSkip(
StringUtils.collectionToCommaDelimitedString(this.tldSkipPatterns));
context.getJarScanner().setJarScanFilter(filter);
}
/** /**
* Override Tomcat's default locale mappings to align with other servers. See * Override Tomcat's default locale mappings to align with other servers. See
* {@code org.apache.catalina.util.CharsetMapperDefault.properties}. * {@code org.apache.catalina.util.CharsetMapperDefault.properties}.
@ -250,6 +243,13 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
} }
} }
private void configureTldSkipPatterns(TomcatEmbeddedContext context) {
StandardJarScanFilter filter = new StandardJarScanFilter();
filter.setTldSkip(
StringUtils.collectionToCommaDelimitedString(this.tldSkipPatterns));
context.getJarScanner().setJarScanFilter(filter);
}
private void addDefaultServlet(Context context) { private void addDefaultServlet(Context context) {
Wrapper defaultServlet = context.createWrapper(); Wrapper defaultServlet = context.createWrapper();
defaultServlet.setName("default"); defaultServlet.setName("default");

@ -41,6 +41,7 @@ public class SampleJettySslApplicationTests {
@Autowired @Autowired
private TestRestTemplate restTemplate; private TestRestTemplate restTemplate;
@Autowired @Autowired
private AbstractConfigurableWebServerFactory webServerFactory; private AbstractConfigurableWebServerFactory webServerFactory;
@ -55,4 +56,5 @@ public class SampleJettySslApplicationTests {
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World"); assertThat(entity.getBody()).isEqualTo("Hello World");
} }
} }

@ -52,10 +52,13 @@ public class SampleTomcatTwoConnectorsApplicationTests {
@LocalServerPort @LocalServerPort
private int port; private int port;
@Autowired @Autowired
private Ports ports; private Ports ports;
@Autowired @Autowired
private TestRestTemplate restTemplate; private TestRestTemplate restTemplate;
@Autowired @Autowired
private AbstractConfigurableWebServerFactory webServerFactory; private AbstractConfigurableWebServerFactory webServerFactory;

@ -31,13 +31,7 @@ public class SampleController {
@GetMapping("/async") @GetMapping("/async")
public Callable<String> helloWorldAsync() { public Callable<String> helloWorldAsync() {
return new Callable<String>() { return () -> "async: Hello World";
@Override
public String call() throws Exception {
return "async: Hello World";
}
};
} }
} }

Loading…
Cancel
Save