• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PropertyPlaceholderAutoConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration的典型用法代码示例。如果您正苦于以下问题:Java PropertyPlaceholderAutoConfiguration类的具体用法?Java PropertyPlaceholderAutoConfiguration怎么用?Java PropertyPlaceholderAutoConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyPlaceholderAutoConfiguration类属于org.springframework.boot.autoconfigure包,在下文中一共展示了PropertyPlaceholderAutoConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: provideCollectorComponent_canSetStorageContainerName

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetStorageContainerName() {

    String storageContainerName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.storageContainerName:" + storageContainerName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(storageContainerName, collector.getStorageContainerName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例2: renderNonWebAppTemplate

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void renderNonWebAppTemplate() throws Exception {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
			ThymeleafAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	assertThat(context.getBeanNamesForType(ViewResolver.class).length).isEqualTo(0);
	try {
		TemplateEngine engine = context.getBean(TemplateEngine.class);
		Context attrs = new Context(Locale.UK,
				Collections.singletonMap("greeting", "Hello World"));
		String result = engine.process("message", attrs);
		assertThat(result).contains("Hello World");
	}
	finally {
		context.close();
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:ThymeleafAutoConfigurationTests.java


示例3: provideCollectorComponent_canSetConsumerGroupName

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetConsumerGroupName() {

    String consumerGroupName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.consumerGroupName:" + consumerGroupName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(consumerGroupName, collector.getConsumerGroupName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例4: provideCollectorComponent_canSetEventHubName

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetEventHubName() {

    String eventHubName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.eventHubName:" + eventHubName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(eventHubName, collector.getEventHubName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例5: provideCollectorComponent_canSetProcessorHostName

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetProcessorHostName() {

    String processorHostName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.processorHostName:" + processorHostName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(processorHostName, collector.getProcessorHostName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例6: provideCollectorComponent_canSetStorageBlobPrefix

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetStorageBlobPrefix() {

    String storageBlobPrefix = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.storageBlobPrefix:" + storageBlobPrefix);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(storageBlobPrefix, collector.getStorageBlobPrefix());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例7: provideCollectorComponent_canSetCheckpointBatchSize

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideCollectorComponent_canSetCheckpointBatchSize() {

    int checkpointBatchSize = 1000;

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.checkpoint-batch-size:" + checkpointBatchSize);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(checkpointBatchSize, collector.getCheckpointBatchSize());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java


示例8: providesCollectorComponent_whenConnectionStringsSet

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void providesCollectorComponent_whenConnectionStringsSet() {
  addEnvironment(context,
      "zipkin.collector.eventhub.connection-string:" + CONNECTION_STRING);
  addEnvironment(context,
      "zipkin.collector.eventhub.storage.connection-string:"
          + STORAGE_CONNECTION_STRING);
  context.register(
      PropertyPlaceholderAutoConfiguration.class,
      ZipkinEventHubCollectorAutoConfiguration.class,
      TestConfiguration.class
  );
  context.refresh();

  ZipkinEventHubCollectorProperties props = context.getBean(ZipkinEventHubCollectorProperties.class);
  assertThat(props.getConnectionString())
      .isEqualTo(CONNECTION_STRING);
  assertThat(props.getStorage().getConnectionString())
      .isEqualTo(STORAGE_CONNECTION_STRING);
}
 
开发者ID:openzipkin,项目名称:zipkin-azure,代码行数:21,代码来源:ZipkinEventHubCollectorAutoConfigurationTest.java


示例9: defaultPropertyValues

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void defaultPropertyValues() throws Exception {
	this.context = new AnnotationConfigEmbeddedWebApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.mobile.devicedelegatingviewresolver.enabled:true");
	this.context.register(Config.class, WebMvcAutoConfiguration.class,
			HttpMessageConvertersAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class,
			DeviceDelegatingViewResolverConfiguration.class);
	this.context.refresh();
	LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context
			.getBean("deviceDelegatingViewResolver",
					LiteDeviceDelegatingViewResolver.class);

	DirectFieldAccessor accessor = new DirectFieldAccessor(
			liteDeviceDelegatingViewResolver);
	assertThat(accessor.getPropertyValue("enableFallback")).isEqualTo(Boolean.FALSE);
	assertThat(accessor.getPropertyValue("normalPrefix")).isEqualTo("");
	assertThat(accessor.getPropertyValue("mobilePrefix")).isEqualTo("mobile/");
	assertThat(accessor.getPropertyValue("tabletPrefix")).isEqualTo("tablet/");
	assertThat(accessor.getPropertyValue("normalSuffix")).isEqualTo("");
	assertThat(accessor.getPropertyValue("mobileSuffix")).isEqualTo("");
	assertThat(accessor.getPropertyValue("tabletSuffix")).isEqualTo("");
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:25,代码来源:DeviceDelegatingViewResolverAutoConfigurationTests.java


示例10: provideAdditionalWriter

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void provideAdditionalWriter() {
	this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
			MetricRepositoryAutoConfiguration.class,
			MetricExportAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	GaugeService gaugeService = this.context.getBean(GaugeService.class);
	assertThat(gaugeService).isNotNull();
	gaugeService.submit("foo", 2.7);
	MetricExporters exporters = this.context.getBean(MetricExporters.class);
	MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
			.get("writer");
	exporter.setIgnoreTimestamps(true);
	exporter.export();
	MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
	Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:18,代码来源:MetricExportAutoConfigurationTests.java


示例11: testDataSourceInitializedWithMultipleScripts

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testDataSourceInitializedWithMultipleScripts() throws Exception {
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.initialize:true",
			"spring.datasource.schema:"
					+ ClassUtils.addResourcePathToPackagePath(getClass(),
							"schema.sql")
					+ ","
					+ ClassUtils.addResourcePathToPackagePath(getClass(),
							"another.sql"),
			"spring.datasource.data:" + ClassUtils
					.addResourcePathToPackagePath(getClass(), "data.sql"));
	this.context.register(DataSourceAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	DataSource dataSource = this.context.getBean(DataSource.class);
	assertThat(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource).isTrue();
	assertThat(dataSource).isNotNull();
	JdbcOperations template = new JdbcTemplate(dataSource);
	assertThat(template.queryForObject("SELECT COUNT(*) from FOO", Integer.class))
			.isEqualTo(1);
	assertThat(template.queryForObject("SELECT COUNT(*) from SPAM", Integer.class))
			.isEqualTo(0);
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:25,代码来源:DataSourceInitializerTests.java


示例12: createLayoutFromConfigClass

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void createLayoutFromConfigClass() throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(ThymeleafAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	MockServletContext servletContext = new MockServletContext();
	context.setServletContext(servletContext);
	context.refresh();
	ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class)
			.resolveViewName("view", Locale.UK);
	MockHttpServletResponse response = new MockHttpServletResponse();
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
	view.render(Collections.singletonMap("foo", "bar"), request, response);
	String result = response.getContentAsString();
	assertThat(result).contains("<title>Content</title>");
	assertThat(result).contains("<span>bar</span>");
	context.close();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:ThymeleafAutoConfigurationTests.java


示例13: testInitializationDisabled

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testInitializationDisabled() throws Exception {
	this.context.register(DataSourceAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();

	DataSource dataSource = this.context.getBean(DataSource.class);

	this.context.publishEvent(new DataSourceInitializedEvent(dataSource));

	assertThat(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource).isTrue();
	assertThat(dataSource).isNotNull();
	JdbcOperations template = new JdbcTemplate(dataSource);

	try {
		template.queryForObject("SELECT COUNT(*) from BAR", Integer.class);
		fail("Query should have failed as BAR table does not exist");
	}
	catch (BadSqlGrammarException ex) {
		SQLException sqlException = ex.getSQLException();
		int expectedCode = -5501; // user lacks privilege or object not found
		assertThat(sqlException.getErrorCode()).isEqualTo(expectedCode);
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:25,代码来源:DataSourceInitializerTests.java


示例14: portIsAvailableInParentContext

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void portIsAvailableInParentContext() {
	ConfigurableApplicationContext parent = new AnnotationConfigApplicationContext();
	parent.refresh();
	try {
		this.context = new AnnotationConfigApplicationContext();
		this.context.setParent(parent);
		EnvironmentTestUtils.addEnvironment(this.context,
				"spring.data.mongodb.port=0");
		this.context.register(EmbeddedMongoAutoConfiguration.class,
				MongoClientConfiguration.class,
				PropertyPlaceholderAutoConfiguration.class);
		this.context.refresh();
		assertThat(parent.getEnvironment().getProperty("local.mongo.port"))
				.isNotNull();
	}
	finally {
		parent.close();
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:21,代码来源:EmbeddedMongoAutoConfigurationTests.java


示例15: testInitializationDisabled

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testInitializationDisabled() throws Exception {
	this.context.register(DataSourceAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	DataSource dataSource = this.context.getBean(DataSource.class);
	this.context.publishEvent(new DataSourceInitializedEvent(dataSource));
	assertThat(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource).isTrue();
	assertThat(dataSource).isNotNull();
	JdbcOperations template = new JdbcTemplate(dataSource);
	try {
		template.queryForObject("SELECT COUNT(*) from BAR", Integer.class);
		fail("Query should have failed as BAR table does not exist");
	}
	catch (BadSqlGrammarException ex) {
		SQLException sqlException = ex.getSQLException();
		int expectedCode = -5501; // user lacks privilege or object not found
		assertThat(sqlException.getErrorCode()).isEqualTo(expectedCode);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:DataSourceInitializerTests.java


示例16: createNodeClientWithOverrides

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void createNodeClientWithOverrides() {
	this.context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.data.elasticsearch.properties.foo.bar:baz",
			"spring.data.elasticsearch.properties.path.home:target",
			"spring.data.elasticsearch.properties.node.local:false",
			"spring.data.elasticsearch.properties.node.data:true",
			"spring.data.elasticsearch.properties.http.enabled:true");
	this.context.register(PropertyPlaceholderAutoConfiguration.class,
			ElasticsearchAutoConfiguration.class);
	this.context.refresh();
	assertThat(this.context.getBeanNamesForType(Client.class).length).isEqualTo(1);
	NodeClient client = (NodeClient) this.context.getBean(Client.class);
	assertThat(client.settings().get("foo.bar")).isEqualTo("baz");
	assertThat(client.settings().get("node.local")).isEqualTo("false");
	assertThat(client.settings().get("node.data")).isEqualTo("true");
	assertThat(client.settings().get("http.enabled")).isEqualTo("true");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:ElasticsearchAutoConfigurationTests.java


示例17: testJpaCoexistsHappily

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testJpaCoexistsHappily() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.url:jdbc:hsqldb:mem:testsecdb");
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.initialize:false");
	this.context.register(EntityConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class,
			DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
			SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class);
	// This can fail if security @Conditionals force early instantiation of the
	// HibernateJpaAutoConfiguration (e.g. the EntityManagerFactory is not found)
	this.context.refresh();
	assertThat(this.context.getBean(JpaTransactionManager.class)).isNotNull();
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:18,代码来源:SecurityAutoConfigurationTests.java


示例18: testRenamePrefix

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testRenamePrefix() throws Exception {
	this.context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.name:batchtest",
			"spring.batch.schema:classpath:batch/custom-schema-hsql.sql",
			"spring.batch.tablePrefix:PREFIX_");
	this.context.register(TestConfiguration.class,
			EmbeddedDataSourceConfiguration.class,
			HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
	assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
			.queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
	JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
	assertThat(jobExplorer.findRunningJobExecutions("test")).isEmpty();
	JobRepository jobRepository = this.context.getBean(JobRepository.class);
	assertThat(jobRepository.getLastJobExecution("test", new JobParameters()))
			.isNull();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:BatchAutoConfigurationTests.java


示例19: testDataSourceInitializedWithExplicitScript

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testDataSourceInitializedWithExplicitScript() throws Exception {
	this.context.register(DataSourceAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.initialize:true",
			"spring.datasource.schema:" + ClassUtils
					.addResourcePathToPackagePath(getClass(), "schema.sql"),
			"spring.datasource.data:" + ClassUtils
					.addResourcePathToPackagePath(getClass(), "data.sql"));
	this.context.refresh();
	DataSource dataSource = this.context.getBean(DataSource.class);
	assertThat(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource).isTrue();
	assertThat(dataSource).isNotNull();
	JdbcOperations template = new JdbcTemplate(dataSource);
	assertThat(template.queryForObject("SELECT COUNT(*) from FOO", Integer.class))
			.isEqualTo(1);
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:19,代码来源:DataSourceInitializerTests.java


示例20: testDataSourceInitializedWithSchemaCredentials

import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; //导入依赖的package包/类
@Test
public void testDataSourceInitializedWithSchemaCredentials() {
	this.context.register(DataSourceAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.datasource.initialize:true",
			"spring.datasource.sqlScriptEncoding:UTF-8",
			"spring.datasource.schema:" + ClassUtils
					.addResourcePathToPackagePath(getClass(), "encoding-schema.sql"),
			"spring.datasource.data:" + ClassUtils
					.addResourcePathToPackagePath(getClass(), "encoding-data.sql"),
			"spring.datasource.schema-username:admin",
			"spring.datasource.schema-password:admin");
	try {
		this.context.refresh();
		fail("User does not exist");
	}
	catch (Exception ex) {
		assertThat(ex).isInstanceOf(UnsatisfiedDependencyException.class);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:DataSourceInitializerTests.java



注:本文中的org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DumbSlave类代码示例发布时间:2022-05-21
下一篇:
Java IDataSource类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap