spring-projects-experimental / spring-boot-testjars

67 stars 6 forks source link

Add application.properties or application.yml convention similar to Spring Boot's profiles #17

Closed rwinch closed 8 months ago

rwinch commented 8 months ago

Adding testjars/application-($beanName).yml or testjars/application-($beanName).properties to the test jar would be a nice convention. For example:

@Bean
@DynamicProperty(name = "messages.url", value = "'http://localhost:' + port")
static CommonsExecWebServer messagesApiServer() {
  return CommonsExecWebServer.builder()
    .classpath(cp -> cp
        .files("build/libs/messages-0.0.1-SNAPSHOT.jar")
    )
    .build();
}

You could set the foo property to bar for the messages application using a yml file at:

src/test/resources/testjars/application-messagesApiServer.yml

foo: bar