user1555190
user1555190

Reputation: 3243

spring specify location of propepties file

I have the following class that im using to start my application up locally with some containers (ommitted). For some reason i cant get it to pick up the local props file, it keeps picking up the application.properties file

I was following this: https://www.baeldung.com/spring-boot-built-in-testcontainers#testcontainers-support-for-local-development

public class LocalDevApplication {

  public static void main(String[] args) {
    SpringApplication.from(App::main)
        .with(LocalTestConfig.class)
        .run(args);
  }

  @TestConfiguration(proxyBeanMethods = false)
  @PropertySource("classpath:application-local.properties")
  static class LocalTestConfig {

    @Value("${my.property}")
    private String myProperty;
}
}

Upvotes: 0

Views: 21

Answers (0)

Related Questions