Skip to content

Document that profiles activated in ~/.spring-boot-devtools.properties will not affect loading of profile-specific configuration files #15151

Closed
@michaldo

Description

@michaldo

v2.1.0.RELEASE

Config

File Content
application-z.properties foo=baz
.spring-boot-devtools.properties spring.profiles.active: z

App

public class MyApp {
	public static void main(String[] args) {
		SpringApplication.run(MyApp.class, args);
                System.out.println("********");
		SpringApplication.run(MyApp.class, "--spring.profiles.include=z");
	}
	
	@Value("${foo:bar}")
	String foo;
	
	@PostConstruct
	void printFoo() {
		System.out.println(foo);
	}
}

Output

 :: Spring Boot ::        (v2.1.0.RELEASE)

2018-11-11 11:20:56.473  INFO 10934 --- [  restartedMain] devproftest.MyApp                        : The following profiles are active: z
bar
********
 :: Spring Boot ::        (v2.1.0.RELEASE)
2018-11-11 11:20:56.586  INFO 10934 --- [  restartedMain] devproftest.MyApp                        : The following profiles are active: z
baz

Expected output

baz, as defined in profile z should be displayed twice

PS. The order of running apps is important - if reverted baz is correctly displayed twice. Please do not be confused by double running - it is used only to have clear test scenario

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions