title: Spring boot application not reading environment specific yaml file when running on external tomcat as war
body: <p>I am working on a Spring boot application which I am running on external Tomcat as a war packaging, passing the spring active environment during Tomcat startup using <code>-Dspring.profiles.active</code> which is being accepted by the Spring application(visible in logs) but when I am trying to read any properties defined in <code>application-dev.yaml</code> application is not able to read any of the properties defined in dev yaml. </p>
  
  <p>I have setup external Tomcat and after building the war file I am placing it in tomcat and starting up the tomcat. In tomcat <code>catalina.bat</code> I have set the <code>set "JAVA_OPTS=%JAVA_OPTS% -Dspring.profiles.active=dev"</code>.</p>
  
  <p>Logs:</p>
  
  <pre><code>2019-07-21 17:16:50.472  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : Starting PurgeServiceApplication v1.0.0 on BLR-LT-101133 with PID 26228 (C:\Users\skumar8\Documents\Tomcat\apache-tomcat-8.5.41\webapps\purge-service\WEB-INF\classes started by SKumar8 in **C:\Users\skumar8\Documents\Tomcat\apache-tomcat-8.5.41\bin)
  2019-07-21 17:16:50.481  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : The following profiles are active: dev**
  2019-07-21 17:16:53.626  INFO 26228 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
  2019-07-21 17:16:53.715  INFO 26228 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 60ms. Found 0 repository interfaces.
  2019-07-21 17:16:54.922  INFO 26228 --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ac299624] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  2019-07-21 17:16:55.244  INFO 26228 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4652 ms
  2019-07-21 17:16:58.855  INFO 26228 --- [ost-startStop-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
          name: default
          ...]
  2019-07-21 17:16:59.223  INFO 26228 --- [ost-startStop-1] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.9.Final}
  2019-07-21 17:16:59.228  INFO 26228 --- [ost-startStop-1] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
  2019-07-21 17:16:59.702  INFO 26228 --- [ost-startStop-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
  2019-07-21 17:17:01.641  INFO 26228 --- [ost-startStop-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.InformixDialect
  2019-07-21 17:17:01.779  INFO 26228 --- [ost-startStop-1] o.h.e.j.e.i.LobCreatorBuilderImpl        : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
  2019-07-21 17:17:02.556  INFO 26228 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
  2019-07-21 17:17:03.399  INFO 26228 --- [ost-startStop-1] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
  2019-07-21 17:17:03.609  WARN 26228 --- [ost-startStop-1] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
  2019-07-21 17:17:04.300  INFO 26228 --- [ost-startStop-1] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
  2019-07-21 17:17:04.397  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : Started PurgeServiceApplication in 15.37 seconds (JVM running for 61.826)
  2019-07-21 17:16:50.472  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : Starting PurgeServiceApplication v1.0.0 on BLR-LT-101133 with PID 26228 (C:\Users\skumar8\Documents\Tomcat\apache-tomcat-8.5.41\webapps\purge-service\WEB-INF\classes started by SKumar8 in C:\Users\skumar8\Documents\Tomcat\apache-tomcat-8.5.41\bin)
  2019-07-21 17:16:50.481  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : The following profiles are active: dev
  2019-07-21 17:16:53.626  INFO 26228 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
  2019-07-21 17:16:53.715  INFO 26228 --- [ost-startStop-1] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 60ms. Found 0 repository interfaces.
  2019-07-21 17:16:54.922  INFO 26228 --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ac299624] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  2019-07-21 17:16:55.244  INFO 26228 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4652 ms
  2019-07-21 17:16:58.855  INFO 26228 --- [ost-startStop-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
          name: default
          ...]
  2019-07-21 17:16:59.223  INFO 26228 --- [ost-startStop-1] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.9.Final}
  2019-07-21 17:16:59.228  INFO 26228 --- [ost-startStop-1] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
  2019-07-21 17:16:59.702  INFO 26228 --- [ost-startStop-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
  2019-07-21 17:17:01.641  INFO 26228 --- [ost-startStop-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.InformixDialect
  2019-07-21 17:17:01.779  INFO 26228 --- [ost-startStop-1] o.h.e.j.e.i.LobCreatorBuilderImpl        : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
  2019-07-21 17:17:02.556  INFO 26228 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
  2019-07-21 17:17:03.399  INFO 26228 --- [ost-startStop-1] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
  2019-07-21 17:17:03.609  WARN 26228 --- [ost-startStop-1] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
  2019-07-21 17:17:04.300  INFO 26228 --- [ost-startStop-1] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
  2019-07-21 17:17:04.397  INFO 26228 --- [ost-startStop-1] c.f.purge.PurgeServiceApplication        : Started PurgeServiceApplication in 15.37 seconds (JVM running for 61.826)
  
  **Properties defined in application-dev.yaml**
  spring:
    cache:
      jcache:
        config: classpath:ehcache.xml
  **Error log**
  java.lang.IllegalArgumentException: Cannot find cache named 'akamaiSecretCache' for Builder
  
  **Debug Option tried**
  </code></pre>
  
  <p>I do have tried with some simple one line property defined in <code>application-dev.yaml</code> but no luck with that also.</p>