Polish docs

This commit is contained in:
Phillip Webb
2021-05-05 23:41:52 -07:00
parent aeea15be0f
commit d3207b107c
31 changed files with 92 additions and 76 deletions

View File

@@ -27,7 +27,10 @@ public class MyReactiveHealthIndicator implements ReactiveHealthIndicator {
@Override
public Mono<Health> health() {
return doHealthCheck().onErrorResume((exception) -> Mono.just(new Health.Builder().down(exception).build()));
// @formatter:off
return doHealthCheck().onErrorResume((exception) ->
Mono.just(new Health.Builder().down(exception).build()));
// @formatter:on
}
private Mono<Health> doHealthCheck() {

View File

@@ -28,11 +28,13 @@ public class MyCouchbaseCacheManagerConfiguration {
@Bean
public CouchbaseCacheManagerBuilderCustomizer myCouchbaseCacheManagerBuilderCustomizer() {
// @formatter:off
return (builder) -> builder
.withCacheConfiguration("cache1",
CouchbaseCacheConfiguration.defaultCacheConfig().entryExpiry(Duration.ofSeconds(10)))
.withCacheConfiguration("cache2",
CouchbaseCacheConfiguration.defaultCacheConfig().entryExpiry(Duration.ofMinutes(1)));
.withCacheConfiguration("cache1", CouchbaseCacheConfiguration
.defaultCacheConfig().entryExpiry(Duration.ofSeconds(10)))
.withCacheConfiguration("cache2", CouchbaseCacheConfiguration
.defaultCacheConfig().entryExpiry(Duration.ofMinutes(1)));
// @formatter:on
}

View File

@@ -28,11 +28,13 @@ public class MyRedisCacheManagerConfiguration {
@Bean
public RedisCacheManagerBuilderCustomizer myRedisCacheManagerBuilderCustomizer() {
// @formatter:off
return (builder) -> builder
.withCacheConfiguration("cache1",
RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(10)))
.withCacheConfiguration("cache2",
RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(1)));
.withCacheConfiguration("cache1", RedisCacheConfiguration
.defaultCacheConfig().entryTtl(Duration.ofSeconds(10)))
.withCacheConfiguration("cache2", RedisCacheConfiguration
.defaultCacheConfig().entryTtl(Duration.ofMinutes(1)));
// @formatter:on
}

View File

@@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportL
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
public class MyConditionEvaluationReportingTests {
class MyConditionEvaluationReportingTests {
@Test
void autoConfigTest() {

View File

@@ -44,7 +44,7 @@ public class MyRestController {
}
@GetMapping("/{user}/customers")
Flux<Customer> getUserCustomers(@PathVariable Long userId) {
public Flux<Customer> getUserCustomers(@PathVariable Long userId) {
return this.userRepository.findById(userId).flatMapMany(this.customerRepository::findByUser);
}

View File

@@ -32,7 +32,7 @@ public class MyBean {
this.amqpTemplate = amqpTemplate;
}
// @fold:on
// @fold:on // ...
public void someMethod() {
this.amqpAdmin.getQueueInfo("someQueue");
}

View File

@@ -34,9 +34,12 @@ public class MyKafkaStreamsConfiguration {
@Bean
public KStream<Integer, String> kStream(StreamsBuilder streamsBuilder) {
KStream<Integer, String> stream = streamsBuilder.stream("ks1In");
stream.map((k, v) -> new KeyValue<>(k, v.toUpperCase())).to("ks1Out",
Produced.with(Serdes.Integer(), new JsonSerde<>()));
stream.map(this::uppercaseValue).to("ks1Out", Produced.with(Serdes.Integer(), new JsonSerde<>()));
return stream;
}
private KeyValue<Integer, String> uppercaseValue(Integer key, String value) {
return new KeyValue<>(key, value.toUpperCase());
}
}

View File

@@ -32,10 +32,10 @@ public class MyBean {
this.databaseClient = databaseClient;
}
// @fold: on // ...
// @fold:on // ...
public Flux<Map<String, Object>> someMethod() {
return this.databaseClient.sql("select * from user").fetch().all();
}
// @fold: off
// @fold:off
}

View File

@@ -31,10 +31,13 @@ public class MyReactorNettyClientConfiguration {
@Bean
ClientHttpConnector clientHttpConnector(ReactorResourceFactory resourceFactory) {
// @formatter:off
HttpClient httpClient = HttpClient.create(resourceFactory.getConnectionProvider())
.runOn(resourceFactory.getLoopResources()).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 60000)
.runOn(resourceFactory.getLoopResources())
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 60000)
.doOnConnected((connection) -> connection.addHandlerLast(new ReadTimeoutHandler(60)));
return new ReactorClientHttpConnector(httpClient);
// @formatter:on
}
}