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


Java RandomValuePropertySource類代碼示例

本文整理匯總了Java中org.springframework.boot.context.config.RandomValuePropertySource的典型用法代碼示例。如果您正苦於以下問題:Java RandomValuePropertySource類的具體用法?Java RandomValuePropertySource怎麽用?Java RandomValuePropertySource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RandomValuePropertySource類屬於org.springframework.boot.context.config包,在下文中一共展示了RandomValuePropertySource類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testBindWithDashPrefix

import org.springframework.boot.context.config.RandomValuePropertySource; //導入依賴的package包/類
@Test
public void testBindWithDashPrefix() throws Exception {
	// gh-4045
	this.targetName = "foo-bar";
	MutablePropertySources propertySources = new MutablePropertySources();
	propertySources.addLast(new SystemEnvironmentPropertySource("systemEnvironment",
			Collections.<String, Object>singletonMap("FOO_BAR_NAME", "blah")));
	propertySources.addLast(new RandomValuePropertySource());
	setupFactory();
	this.factory.setPropertySources(propertySources);
	this.factory.afterPropertiesSet();
	Foo foo = this.factory.getObject();
	assertThat(foo.name).isEqualTo("blah");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:PropertiesConfigurationFactoryTests.java

示例2: testBindWithDelimitedPrefixUsingMatchingDelimiter

import org.springframework.boot.context.config.RandomValuePropertySource; //導入依賴的package包/類
@Test
public void testBindWithDelimitedPrefixUsingMatchingDelimiter() throws Exception {
	this.targetName = "env_foo";
	this.ignoreUnknownFields = false;
	MutablePropertySources propertySources = new MutablePropertySources();
	propertySources.addLast(new SystemEnvironmentPropertySource("systemEnvironment",
			Collections.<String, Object>singletonMap("ENV_FOO_NAME", "blah")));
	propertySources.addLast(new RandomValuePropertySource("random"));
	setupFactory();
	this.factory.setPropertySources(propertySources);
	this.factory.afterPropertiesSet();
	Foo foo = this.factory.getObject();
	assertThat(foo.name).isEqualTo("blah");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:PropertiesConfigurationFactoryTests.java

示例3: testBindWithDelimitedPrefixUsingDifferentDelimiter

import org.springframework.boot.context.config.RandomValuePropertySource; //導入依賴的package包/類
@Test
public void testBindWithDelimitedPrefixUsingDifferentDelimiter() throws Exception {
	this.targetName = "env.foo";
	MutablePropertySources propertySources = new MutablePropertySources();
	propertySources.addLast(new SystemEnvironmentPropertySource("systemEnvironment",
			Collections.<String, Object>singletonMap("ENV_FOO_NAME", "blah")));
	propertySources.addLast(new RandomValuePropertySource("random"));
	this.ignoreUnknownFields = false;
	setupFactory();
	this.factory.setPropertySources(propertySources);
	this.factory.afterPropertiesSet();
	Foo foo = this.factory.getObject();
	assertThat(foo.name).isEqualTo("blah");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:PropertiesConfigurationFactoryTests.java

示例4: testBindWithDashPrefix

import org.springframework.boot.context.config.RandomValuePropertySource; //導入依賴的package包/類
@Test
public void testBindWithDashPrefix() throws Exception {
	// gh-4045
	this.targetName = "foo-bar";
	MutablePropertySources propertySources = new MutablePropertySources();
	propertySources.addLast(new SystemEnvironmentPropertySource("systemEnvironment",
			Collections.<String, Object>singletonMap("FOO_BAR_NAME", "blah")));
	propertySources.addLast(new RandomValuePropertySource("random"));
	setupFactory();
	this.factory.setPropertySources(propertySources);
	this.factory.afterPropertiesSet();
	Foo foo = this.factory.getObject();
	assertEquals("blah", foo.name);
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:15,代碼來源:PropertiesConfigurationFactoryTests.java


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