Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring.config.name has not effect when set in bootstrap.properties #566

Closed
ryanjbaxter opened this issue May 24, 2019 · 4 comments
Closed
Labels
Projects

Comments

@ryanjbaxter
Copy link
Contributor

In Greenwich and prior releases setting spring.config.name in bootstrap.[yml | properties] would cause boot to look for a configuration file equal to spring.config.name. This does not work in master (Hoxton). To reproduce add a file called confignamebootstrap.properties to /test/resources and place the following properties in the file

spring.application.name:main
spring.config.name:plain

Then in BootstrapConfigurationTests add the following test

	@Test
	public void configNameInBootstrap() {
		System.setProperty("expected.name", "main");
		this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
				.properties("spring.cloud.bootstrap.name:confignamebootstrap")
				.sources(BareConfiguration.class).run();
		then(this.context.getEnvironment().getProperty("spring.application.name"))
				.isEqualTo("app");
		// The parent is called "main" because spring.application.name is specified in
		// other.properties (the bootstrap properties)
		then(this.context.getParent().getEnvironment()
				.getProperty("spring.application.name")).isEqualTo("main");
		// The bootstrap context has the same "bootstrap" property source
		then(((ConfigurableEnvironment) this.context.getParent().getEnvironment())
				.getPropertySources().get("bootstrap"))
				.isEqualTo(this.context.getEnvironment().getPropertySources()
						.get("bootstrap"));
		then(this.context.getId()).isEqualTo("main-1");
	}

This test passes in 2.1.x but fails in master.

@ryanjbaxter ryanjbaxter added this to To do in Hoxton.M1 via automation May 24, 2019
@ryanjbaxter ryanjbaxter added this to the 2.2.0.M1 milestone May 24, 2019
@ryanjbaxter
Copy link
Contributor Author

Had to ignore this test due to this bug
spring-cloud/spring-cloud-core-tests@ce2d478

@ryanjbaxter
Copy link
Contributor Author

Also wondering if this might be related at all f5e1bfd#diff-120f54fb381ae7aae2ba6c97156a8199

@ryanjbaxter
Copy link
Contributor Author

I opened an issue in boot that I think traced the root cause of the problem spring-projects/spring-boot#17011

@spencergibb spencergibb added this to To do in Hoxton.M2 via automation Jul 3, 2019
@spencergibb spencergibb removed this from To do in Hoxton.M1 Jul 3, 2019
@spencergibb spencergibb removed this from the 2.2.0.M1 milestone Jul 3, 2019
@spencergibb spencergibb added this to To do in Hoxton.M3 via automation Aug 16, 2019
@spencergibb spencergibb removed this from To do in Hoxton.M2 Aug 16, 2019
@ryanjbaxter
Copy link
Contributor Author

The issues in boot have been addressed, so I am closing this issue.

Hoxton.M3 automation moved this from To do to Done Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Hoxton.M3
  
Done
Development

No branches or pull requests

2 participants