當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectProvider.getIfUnique方法代碼示例

本文整理匯總了Java中org.springframework.beans.factory.ObjectProvider.getIfUnique方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectProvider.getIfUnique方法的具體用法?Java ObjectProvider.getIfUnique怎麽用?Java ObjectProvider.getIfUnique使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.factory.ObjectProvider的用法示例。


在下文中一共展示了ObjectProvider.getIfUnique方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: memcachedClient

import org.springframework.beans.factory.ObjectProvider; //導入方法依賴的package包/類
@Bean
public MemcachedClient memcachedClient(ObjectProvider<ConnectionFactory> connection) throws IOException {
    final List<InetSocketAddress> addresses = new ArrayList<>();
    final String servers = environment.getProperty("memcached.servers");
    if (StringUtils.isEmpty(servers)) {
        addresses.add(new InetSocketAddress(LOCALHOST, DEFAULT_PORT));
    } else {
        for (final String server : servers.split(",")) {
            final int colon = server.indexOf(":");
            if (colon == -1) {
                addresses.add(new InetSocketAddress(server, DEFAULT_PORT));
            } else {
                final int port = Integer.parseInt(server.substring(colon + 1));
                addresses.add(new InetSocketAddress(server.substring(0, colon), port));
            }
        }
    }

    ConnectionFactory con = connection.getIfUnique();

    return con == null
            ? new MemcachedClient(addresses)
            : new MemcachedClient(con, addresses);
}
 
開發者ID:bmatthews68,項目名稱:memcached-spring-boot-starter,代碼行數:25,代碼來源:MemcachedAutoConfiguration.java

示例2: MyBatisMigrationsConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入方法依賴的package包/類
public MyBatisMigrationsConfiguration(MyBatisMigrationsProperties properties,
		ObjectProvider<DataSource> dataSource,
		@MyBatisMigrationsDataSource ObjectProvider<DataSource> myBatisMigrationsDataSource,
		ResourcePatternResolver resourceResolver) {

	this.properties = properties;
	this.resourceResolver = resourceResolver;
	this.dataSource = dataSource.getIfUnique();
	this.myBatisMigrationsDataSource = myBatisMigrationsDataSource.getIfAvailable();
}
 
開發者ID:Bessonov,項目名稱:mybatis-migrations-spring-boot-autoconfigure,代碼行數:11,代碼來源:MyBatisMigrationsAutoConfiguration.java

示例3: EnableWebMvcConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入方法依賴的package包/類
public EnableWebMvcConfiguration(
		ObjectProvider<WebMvcProperties> mvcPropertiesProvider,
		ObjectProvider<WebMvcRegistrations> mvcRegistrationsProvider,
		ListableBeanFactory beanFactory) {
	this.mvcProperties = mvcPropertiesProvider.getIfAvailable();
	this.mvcRegistrations = mvcRegistrationsProvider.getIfUnique();
	this.beanFactory = beanFactory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:9,代碼來源:WebMvcAutoConfiguration.java

示例4: FlywayConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入方法依賴的package包/類
public FlywayConfiguration(FlywayProperties properties,
		ResourceLoader resourceLoader,
		ObjectProvider<DataSource> dataSourceProvider,
		@FlywayDataSource ObjectProvider<DataSource> flywayDataSourceProvider,
		ObjectProvider<FlywayMigrationStrategy> migrationStrategyProvider) {
	this.properties = properties;
	this.resourceLoader = resourceLoader;
	this.dataSource = dataSourceProvider.getIfUnique();
	this.flywayDataSource = flywayDataSourceProvider.getIfAvailable();
	this.migrationStrategy = migrationStrategyProvider.getIfAvailable();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:FlywayAutoConfiguration.java

示例5: SessionProperties

import org.springframework.beans.factory.ObjectProvider; //導入方法依賴的package包/類
public SessionProperties(ObjectProvider<ServerProperties> serverProperties) {
	ServerProperties properties = serverProperties.getIfUnique();
	this.timeout = (properties != null ? properties.getSession().getTimeout() : null);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:5,代碼來源:SessionProperties.java


注:本文中的org.springframework.beans.factory.ObjectProvider.getIfUnique方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。