Application.java
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package etunicorn;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
<<<<<<< HEAD
import org.springframework.context.annotation.Bean;
=======
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import javax.sql.DataSource;
>>>>>>> 8cbe108cd842b37e3fe6c969ad942e5651d557b3
/**
* Created by geoffrey on 28/01/17.
*/
@SpringBootApplication
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public CommandLineRunner demo(PermissionRepository permissionRepository) {
return (args) -> {
permissionRepository.save(new Permission("ROLE_ADMIN"));
permissionRepository.save(new Permission("CONSO_ADMIN"));
permissionRepository.save(new Permission("EVNMT_ADMIN"));
// ...
};
}
public DataSource dataSource(){
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName("org.sqlite.JDBC");
dataSourceBuilder.url("jdbc:sqlite:etunicorn.db");
return dataSourceBuilder.build();
}
}