Blame view

src/main/java/etunicorn/Application.java 884 Bytes
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
1
2
3
  package etunicorn;
  
  import org.springframework.boot.SpringApplication;
8cbe108c   badetitou   Connect to Database
4
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
5
  import org.springframework.boot.autoconfigure.SpringBootApplication;
8cbe108c   badetitou   Connect to Database
6
7
8
9
  import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
  import org.springframework.context.annotation.Bean;
  
  import javax.sql.DataSource;
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
10
11
12
13
14
  
  /**
   * Created by geoffrey on 28/01/17.
   */
  @SpringBootApplication
8cbe108c   badetitou   Connect to Database
15
  @EnableAutoConfiguration
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
16
  public class Application {
8cbe108c   badetitou   Connect to Database
17
  
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
18
19
20
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
8cbe108c   badetitou   Connect to Database
21
22
23
24
25
26
27
28
29
  
      @Bean
      public DataSource dataSource(){
          DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
          dataSourceBuilder.driverClassName("org.sqlite.JDBC");
          dataSourceBuilder.url("jdbc:sqlite:etunicorn.db");
          return dataSourceBuilder.build();
      }
  
f0930f9b   Geoffrey PREUD'HOMME   Eh, j'avais oubli...
30
  }