title: Spring Boot Application not reading application.properties file when using Maven test
body: <h2>UPDATE:</h2>
  <p>I realized a couple of things now. My <code>application.properties</code> file is being loaded properly because I verified via the <code>/env</code> path (thanks Dave) that my DB properties are being loaded. The problem appears to be that when I run it using the Spring Boot maven plug-in, it fails to initialize my <code>dataSource</code>.</p>
  <pre><code>mvn spring-boot:run
  </code></pre>
  <p>This then causes my application to blow-up with errors because other beans can't get initialized. The odd thing is it runs fine from Eclipse.</p>
  <p>I have a class called <code>DataService</code> that extends <code>JdbcTemplate</code>. In my <code>DataService</code> constructor, I inject the <code>DataSource</code>.</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  public class DataService extends JdbcTemplate  {
  
    @Autowired
    public DataService(DataSource dataSource){
      super(dataSource);
    }
      ...more custom methods
  }
  </code></pre>
  <p>I use this <code>DataService</code> class in other beans to perform DB operations. My <code>DataSource</code> is defined in my <code>application.properties</code> file</p>
  <pre><code>spring.datasource.url: jdbc:h2:tcp://localhost/~/testdb2
  spring.datasource.driverClassName: org.h2.Driver
  </code></pre>
  <p>This is my <code>Application.java</code> class</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  @EnableWebMvcSecurity
  @EnableAsync
  @EnableScheduling
  public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  <p>I first realized this when I was attempting to run <code>jUnit</code> tests from Maven using</p>
  <pre><code>mavent test
  </code></pre>
  <p>I thought it just had to do with how it was executing the <code>jUnit</code> test cases however it is also occurring when I simply try to run the application using maven.</p>
  <p>My <code>JUnit4</code> test class is defined as follows:</p>
  <pre class="lang-java prettyprint-override"><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringApplicationConfiguration(classes={Application.class})
  @WebAppConfiguration
  public class QuestionRepositoryIntegrationTests {
      ...methods
  }
  </code></pre>
  <p>I used the example from the Spring Boot how-to docs (<a href="https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html" rel="nofollow noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html</a>)</p>
  <p>When I run this <code>JUnit</code> class from Eclipse, it works just fine. When it executes from maven, it starts to act up as I described above.</p>