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


Java SimpleProperties類代碼示例

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


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

示例1: simpleProperties

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void simpleProperties() throws Exception {
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata)
			.has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
	assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
			.fromSource(SimpleProperties.class)
			.withDescription("The name of this simple properties.")
			.withDefaultValue("boot").withDeprecation(null, null));
	assertThat(metadata).has(Metadata.withProperty("simple.flag", Boolean.class)
			.fromSource(SimpleProperties.class).withDescription("A simple flag.")
			.withDeprecation(null, null));
	assertThat(metadata).has(Metadata.withProperty("simple.comparator"));
	assertThat(metadata).doesNotHave(Metadata.withProperty("simple.counter"));
	assertThat(metadata).doesNotHave(Metadata.withProperty("simple.size"));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例2: mergingOfHintWithProvider

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfHintWithProvider() throws Exception {
	writeAdditionalHints(new ItemHint("simple.theName",
			Collections.<ItemHint.ValueHint>emptyList(),
			Arrays.asList(
					new ItemHint.ValueProvider("first",
							Collections.<String, Object>singletonMap("target",
									"org.foo")),
					new ItemHint.ValueProvider("second", null))));
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
			.fromSource(SimpleProperties.class)
			.withDescription("The name of this simple properties.")
			.withDefaultValue("boot").withDeprecation(null, null));
	assertThat(metadata).has(Metadata.withHint("simple.the-name")
			.withProvider("first", "target", "org.foo").withProvider("second"));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:18,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例3: mergingOfAdditionalMetadata

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfAdditionalMetadata() throws Exception {
	File metaInfFolder = new File(this.compiler.getOutputLocation(), "META-INF");
	metaInfFolder.mkdirs();
	File additionalMetadataFile = new File(metaInfFolder,
			"additional-spring-configuration-metadata.json");
	additionalMetadataFile.createNewFile();
	JSONObject property = new JSONObject();
	property.put("name", "foo");
	property.put("type", "java.lang.String");
	property.put("sourceType", AdditionalMetadata.class.getName());
	JSONArray properties = new JSONArray();
	properties.put(property);
	JSONObject additionalMetadata = new JSONObject();
	additionalMetadata.put("properties", properties);
	FileWriter writer = new FileWriter(additionalMetadataFile);
	additionalMetadata.write(writer);
	writer.flush();
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.comparator"));
	assertThat(metadata).has(Metadata.withProperty("foo", String.class)
			.fromSource(AdditionalMetadata.class));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:24,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例4: simpleProperties

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void simpleProperties() throws Exception {
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata, containsGroup("simple").fromSource(SimpleProperties.class));
	assertThat(metadata,
			containsProperty("simple.the-name", String.class)
					.fromSource(SimpleProperties.class)
					.withDescription("The name of this simple properties.")
					.withDefaultValue(is("boot")).withDeprecation(null, null));
	assertThat(metadata,
			containsProperty("simple.flag", Boolean.class)
					.fromSource(SimpleProperties.class)
					.withDescription("A simple flag.").withDeprecation(null, null));
	assertThat(metadata, containsProperty("simple.comparator"));
	assertThat(metadata, not(containsProperty("simple.counter")));
	assertThat(metadata, not(containsProperty("simple.size")));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:18,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例5: mergingOfHintWithProvider

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfHintWithProvider() throws Exception {
	writeAdditionalHints(new ItemHint("simple.theName",
			Collections.<ItemHint.ValueHint>emptyList(),
			Arrays.asList(
					new ItemHint.ValueProvider("first",
							Collections.<String, Object>singletonMap("target",
									"org.foo")),
					new ItemHint.ValueProvider("second", null))));
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata,
			containsProperty("simple.the-name", String.class)
					.fromSource(SimpleProperties.class)
					.withDescription("The name of this simple properties.")
					.withDefaultValue(is("boot")).withDeprecation(null, null));
	assertThat(metadata, containsHint("simple.the-name")
			.withProvider("first", "target", "org.foo").withProvider("second"));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:19,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例6: mergingOfAdditionalProperty

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfAdditionalProperty() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String",
			AdditionalMetadata.class.getName(), null, null, null, null);
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.comparator"));
	assertThat(metadata).has(Metadata.withProperty("foo", String.class)
			.fromSource(AdditionalMetadata.class));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例7: mergeExistingPropertyDefaultValue

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergeExistingPropertyDefaultValue() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null,
			null, null, true, null);
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.flag", Boolean.class)
			.fromSource(SimpleProperties.class).withDescription("A simple flag.")
			.withDeprecation(null, null).withDefaultValue(true));
	assertThat(metadata.getItems()).hasSize(4);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例8: mergeExistingPropertyDescription

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergeExistingPropertyDescription() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null,
			null, null, "A nice comparator.", null, null);
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata)
			.has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>")
					.fromSource(SimpleProperties.class)
					.withDescription("A nice comparator."));
	assertThat(metadata.getItems()).hasSize(4);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:13,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例9: mergeExistingPropertyDeprecation

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergeExistingPropertyDeprecation() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null,
			null, null, null, null,
			new ItemDeprecation("Don't use this.", "simple.complex-comparator"));
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata)
			.has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>")
					.fromSource(SimpleProperties.class)
					.withDeprecation("Don't use this.", "simple.complex-comparator"));
	assertThat(metadata.getItems()).hasSize(4);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例10: mergeOfInvalidAdditionalMetadata

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergeOfInvalidAdditionalMetadata() throws IOException {
	File additionalMetadataFile = createAdditionalMetadataFile();
	FileCopyUtils.copy("Hello World", new FileWriter(additionalMetadataFile));

	this.thrown.expect(IllegalStateException.class);
	this.thrown.expectMessage("Compilation failed");
	compile(SimpleProperties.class);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例11: mergingOfSimpleHint

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfSimpleHint() throws Exception {
	writeAdditionalHints(ItemHint.newHint("simple.the-name",
			new ItemHint.ValueHint("boot", "Bla bla"),
			new ItemHint.ValueHint("spring", null)));
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
			.fromSource(SimpleProperties.class)
			.withDescription("The name of this simple properties.")
			.withDefaultValue("boot").withDeprecation(null, null));
	assertThat(metadata).has(Metadata.withHint("simple.the-name")
			.withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例12: mergingOfHintWithNonCanonicalName

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfHintWithNonCanonicalName() throws Exception {
	writeAdditionalHints(ItemHint.newHint("simple.theName",
			new ItemHint.ValueHint("boot", "Bla bla")));
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
			.fromSource(SimpleProperties.class)
			.withDescription("The name of this simple properties.")
			.withDefaultValue("boot").withDeprecation(null, null));
	assertThat(metadata).has(
			Metadata.withHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:13,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例13: mergingOfAdditionalDeprecation

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfAdditionalDeprecation() throws Exception {
	writePropertyDeprecation(ItemMetadata.newProperty("simple", "wrongName",
			"java.lang.String", null, null, null, null,
			new ItemDeprecation("Lame name.", "simple.the-name")));
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata).has(Metadata.withProperty("simple.wrong-name", String.class)
			.withDeprecation("Lame name.", "simple.the-name"));
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例14: mergingOfAdditionalProperty

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergingOfAdditionalProperty() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String",
			AdditionalMetadata.class.getName(), null, null, null, null);
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata, containsProperty("simple.comparator"));
	assertThat(metadata, containsProperty("foo", String.class)
			.fromSource(AdditionalMetadata.class));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:11,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java

示例15: mergeExistingPropertyDefaultValue

import org.springframework.boot.configurationsample.simple.SimpleProperties; //導入依賴的package包/類
@Test
public void mergeExistingPropertyDefaultValue() throws Exception {
	ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null,
			null, null, true, null);
	writeAdditionalMetadata(property);
	ConfigurationMetadata metadata = compile(SimpleProperties.class);
	assertThat(metadata,
			containsProperty("simple.flag", Boolean.class)
					.fromSource(SimpleProperties.class)
					.withDescription("A simple flag.").withDefaultValue(is(true)));
	assertThat(metadata.getItems().size(), is(4));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:13,代碼來源:ConfigurationMetadataAnnotationProcessorTests.java


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