diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml deleted file mode 100644 index 6b5599d..0000000 --- a/.idea/dataSources.local.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - master_key - false - - - \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index 5b54b95..0000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - sqlite.xerial - true - org.sqlite.JDBC - jdbc:sqlite:$PROJECT_DIR$/etunicorn.db - - - - - - \ No newline at end of file diff --git a/etunicorn-server.iml b/etunicorn-server.iml index 5a41014..062692d 100644 --- a/etunicorn-server.iml +++ b/etunicorn-server.iml @@ -82,9 +82,8 @@ - + - diff --git a/pom.xml b/pom.xml index dd92414..0c0254d 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,7 @@ mysql mysql-connector-java + 5.1.6 @@ -42,10 +43,6 @@ 2.3 - com.h2database - h2 - - org.springframework.boot spring-boot-autoconfigure 1.4.4.RELEASE diff --git a/src/main/java/etunicorn/Application.java b/src/main/java/etunicorn/Application.java index ece51bf..f6b8478 100644 --- a/src/main/java/etunicorn/Application.java +++ b/src/main/java/etunicorn/Application.java @@ -1,9 +1,6 @@ package etunicorn; import etunicorn.entity.Permission; -import etunicorn.entity.Personne; -import etunicorn.entity.Role; -import etunicorn.entity.Session; import etunicorn.repository.PermissionRepository; import etunicorn.repository.PersonneRepository; import etunicorn.repository.RoleRepository; @@ -13,18 +10,15 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.DriverManagerDataSource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import javax.sql.DataSource; /** * etunicorn-server * Copyright © 2017 Le Club Info Polytech Lille * Tous droits réservés */ -@Configuration @SpringBootApplication @EnableAutoConfiguration public class Application { @@ -52,23 +46,23 @@ public class Application { permissionRepository.save(new Permission("ROLE_PERMISSION_REMOVE")); // ... - roleRepository.save(new Role("admin", (List) permissionRepository.findAll())); - roleRepository.save(new Role("etudiant", new ArrayList<>())); - personneRepository.save(new Personne("carte", new Date(), "gbontoux", roleRepository.findByNom("admin"))); - sessionRepository.save(new Session(personneRepository.findByLogin("gbontoux"), "A", new Date(new Date().getTime() + 1000 * 60 * 10))); + //roleRepository.save(new Role("admin", (List) permissionRepository.findAll())); + //roleRepository.save(new Role("etudiant", new ArrayList<>())); + //personneRepository.save(new Personne("546848", new Date(), "bverhaeg", roleRepository.findByNom("admin"))); + //sessionRepository.save(new Session(personneRepository.findByLogin("bverhaeg"), "B", new Date(new Date().getTime() + 1000 * 60 * 10))); }; } - // @Bean - // public DataSource dataSource() { - // DriverManagerDataSource dataSource = new DriverManagerDataSource(); - // dataSource.setDriverClassName("com.mysql.jdbc.Driver"); - // dataSource.setUrl("jdbc:mysql://localhost/etunicorn"); - // dataSource.setUsername("etunicorn"); - // dataSource.setPassword("etunicorn"); - // return dataSource; - // } + @Bean + public DataSource dataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("com.mysql.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://192.168.0.28:3306/bade"); + dataSource.setUsername("bade"); + dataSource.setPassword("bade"); + return dataSource; + } // Properties additionalProperties() { // Properties properties = new Properties(); diff --git a/src/main/ressources/application.yml b/src/main/ressources/application.yml new file mode 100644 index 0000000..a2ac22c --- /dev/null +++ b/src/main/ressources/application.yml @@ -0,0 +1,5 @@ +spring: + jpa: + database-platform: org.hibernate.dialect.MySQL5Dialect + hibernate: + ddl-auto: update \ No newline at end of file -- libgit2 0.21.2