List of usage examples for org.springframework.boot.context.properties PropertyMapper get
public static PropertyMapper get()
From source file:io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakerProperties.java
@Override protected void buildRecordFailurePredicate(BackendProperties properties, CircuitBreakerConfig.Builder builder) { PropertyMapper.get().from(properties::getRecordFailurePredicate).whenNonNull() .as(BeanUtils::instantiateClass).to(builder::recordFailure); }
From source file:org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration.java
@Bean @ConditionalOnMissingBean// ww w .j av a 2s .c o m public RestClientBuilder restClientBuilder() { HttpHost[] hosts = this.properties.getUris().stream().map(HttpHost::create).toArray(HttpHost[]::new); RestClientBuilder builder = RestClient.builder(hosts); PropertyMapper map = PropertyMapper.get(); map.from(this.properties::getUsername).whenHasText().to((username) -> { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); Credentials credentials = new UsernamePasswordCredentials(this.properties.getUsername(), this.properties.getPassword()); credentialsProvider.setCredentials(AuthScope.ANY, credentials); builder.setHttpClientConfigCallback( (httpClientBuilder) -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)); }); this.builderCustomizers.orderedStream().forEach((customizer) -> customizer.customize(builder)); return builder; }