use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class CassandraAutoConfiguration method mapPoolingOptions.
private void mapPoolingOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
CassandraProperties.Pool poolProperties = properties.getPool();
map.from(poolProperties::getIdleTimeout).asInt(Duration::toMillis).to((idleTimeout) -> options.add(DefaultDriverOption.HEARTBEAT_TIMEOUT, idleTimeout));
map.from(poolProperties::getHeartbeatInterval).asInt(Duration::toMillis).to((heartBeatInterval) -> options.add(DefaultDriverOption.HEARTBEAT_INTERVAL, heartBeatInterval));
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class CassandraAutoConfiguration method mapConnectionOptions.
private void mapConnectionOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
Connection connectionProperties = properties.getConnection();
map.from(connectionProperties::getConnectTimeout).asInt(Duration::toMillis).to((connectTimeout) -> options.add(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT, connectTimeout));
map.from(connectionProperties::getInitQueryTimeout).asInt(Duration::toMillis).to((initQueryTimeout) -> options.add(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, initQueryTimeout));
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class BasicBatchConfigurer method createJobRepository.
protected JobRepository createJobRepository() throws Exception {
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
PropertyMapper map = PropertyMapper.get();
map.from(this.dataSource).to(factory::setDataSource);
map.from(this::determineIsolationLevel).whenNonNull().to(factory::setIsolationLevelForCreate);
map.from(this.properties.getJdbc()::getTablePrefix).whenHasText().to(factory::setTablePrefix);
map.from(this::getTransactionManager).to(factory::setTransactionManager);
factory.afterPropertiesSet();
return factory.getObject();
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class LdapAutoConfiguration method ldapContextSource.
@Bean
@ConditionalOnMissingBean
public LdapContextSource ldapContextSource(LdapProperties properties, Environment environment, ObjectProvider<DirContextAuthenticationStrategy> dirContextAuthenticationStrategy) {
LdapContextSource source = new LdapContextSource();
dirContextAuthenticationStrategy.ifUnique(source::setAuthenticationStrategy);
PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
propertyMapper.from(properties.getUsername()).to(source::setUserDn);
propertyMapper.from(properties.getPassword()).to(source::setPassword);
propertyMapper.from(properties.getAnonymousReadOnly()).to(source::setAnonymousReadOnly);
propertyMapper.from(properties.getBase()).to(source::setBase);
propertyMapper.from(properties.determineUrls(environment)).to(source::setUrls);
propertyMapper.from(properties.getBaseEnvironment()).to((baseEnvironment) -> source.setBaseEnvironmentProperties(Collections.unmodifiableMap(baseEnvironment)));
return source;
}
use of org.springframework.boot.context.properties.PropertyMapper in project spring-boot by spring-projects.
the class LdapAutoConfiguration method ldapTemplate.
@Bean
@ConditionalOnMissingBean(LdapOperations.class)
public LdapTemplate ldapTemplate(LdapProperties properties, ContextSource contextSource) {
Template template = properties.getTemplate();
PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
propertyMapper.from(template.isIgnorePartialResultException()).to(ldapTemplate::setIgnorePartialResultException);
propertyMapper.from(template.isIgnoreNameNotFoundException()).to(ldapTemplate::setIgnoreNameNotFoundException);
propertyMapper.from(template.isIgnoreSizeLimitExceededException()).to(ldapTemplate::setIgnoreSizeLimitExceededException);
return ldapTemplate;
}
Aggregations