How to configure spring boot to set hibernate's config using application.properties
<p>I've been following this <a href="http://blog.netgloo.com/2014/10/27/using-mysql-in-spring-boot-via-spring-data-jpa-and-hibernate/" rel="nofollow noreferrer">tutorial</a> to implement Hibernate into my application. However, I do not know how to read the application.properties mentioned in it. I've read the <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html" rel="nofollow noreferrer">doc</a> too, it is mentioned :</p>

<ul>
<li>A /config subdirectory of the current directory. </li>
<li>The current directory </li>
<li>A classpath /config package </li>
<li>The classpath root</li>
</ul>

<p>But what's the current directory with spring boot?</p>

<p>I am also <em>not</em> using the following dependencies (cf tutorial), could my problem be solved by using them ? It is causing a dependencies clash :</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
</code></pre>

<p>Also, simply putting applications.properties in src/main/resources as detailed in the tutorial doesn't work.
It does work if I manually set the following (this is what I use with Spring Security) :</p>

<pre><code>  @Bean(name = "dataSource")
  public DriverManagerDataSource dataSource() {
      DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
      driverManagerDataSource.setDriverClassName("com.mysql.jdbc.Driver");
      driverManagerDataSource.setUrl("jdbc:mysql://localhost:3306/hibernate");
      driverManagerDataSource.setUsername("root");
      driverManagerDataSource.setPassword("root");
      return driverManagerDataSource;
  }
</code></pre>

<p>But if I remove the previous code, it definitely doesn't find applications.properties :</p>

<p><code>Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
    - Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
    - Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans</code></p>

<p>Would anyone know how to solve this problem, or have a lead ? Thanks!</p>

<p>Edit :</p>

<p>So a little bit more explanations on what I've done. Here's the architecture of my project : <a href="https://imgur.com/a/V3f7p" rel="nofollow noreferrer">http://imgur.com/a/V3f7p</a></p>

<p>As I said, my pom is different, here is it : <a href="http://pastebin.com/fjrfKcVX" rel="nofollow noreferrer">http://pastebin.com/fjrfKcVX</a></p>

<p>I have a WebMvcConfigurerAdapter, which shouldn't interfere with anything :</p>

<pre><code>@Configuration
@EnableWebMvc
public class MvcConfiguration extends WebMvcConfigurerAdapter {
    @Bean(name = "simpleMappingExceptionResolver")
    public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
        SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();

        Properties mappings = new Properties();
       mappings.setProperty("ClassNotFoundException", "greeting");
       mappings.setProperty("SQLException", "greeting");
       mappings.setProperty("IOException", "greeting");

        r.setExceptionMappings(mappings); // None by default
        r.setDefaultErrorView("error"); // No default
        r.setExceptionAttribute("ex"); // Default is "exception"
        r.setWarnLogCategory("example.MvcLogger"); // No default
        return r;
    }

      @Override
        public void addViewControllers(ViewControllerRegistry registry) {
         /*   registry.addViewController("/accueil").setViewName("accueil");
            registry.addViewController("/").setViewName("accueil");
            registry.addViewController("/hello").setViewName("hello");
            registry.addViewController("/login").setViewName("login");*/
          registry.addViewController("/accessdenied").setViewName("accessdenied");
        }

    /*  @Bean(name = "dataSource")
      public DriverManagerDataSource dataSource() {
          DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
          driverManagerDataSource.setDriverClassName("com.mysql.jdbc.Driver");
          driverManagerDataSource.setUrl("jdbc:mysql://localhost:3306/ai_15");
          driverManagerDataSource.setUsername("root");
          driverManagerDataSource.setPassword("root");
          return driverManagerDataSource;
      }*/


}
</code></pre>

<p>Aside from that, it is identical and nothing is interfering with Hibernate. I've just renamed everything as 'Test', such as <strong>TestDAO.java</strong>.</p>

<p>Edit 2 : my <em>application.properties</em> file is identical to the one in the tutorial, except the following line :</p>

<p><code>spring.datasource.url = jdbc:mysql://localhost:3306/hibernate</code></p>