title: Load sql script at spring application startup
body: <p>I have a sql script with insert commands and I want to load the data in the database with that script at the startup of the spring application. How can i do that?</p>
  
  <p>My <code>application.yml</code></p>
  
  <pre><code>datasource:
      url: jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false
      name:
      username: root
      password: root
      hikari:
          data-source-properties:
              cachePrepStmts: true
              prepStmtCacheSize: 250
              prepStmtCacheSqlLimit: 2048
              useServerPrepStmts: true
  jpa:
      database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
      database: MYSQL
      show-sql: true
      properties:
          hibernate.cache.use_second_level_cache: true
          hibernate.cache.use_query_cache: false
          hibernate.generate_statistics: true
          hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
  </code></pre>
  
  <p>I have declared <code>data.sql</code> in <code>src/main/resources/data.sql</code>, but the data is not loaded in the database at runtime and application logs also doesn't give any errors.</p>