Commit ed186bbbf9521c3255d63bd03e1e413661c4ab60

Authored by Geoffrey PREUD'HOMME
2 parents 8799baa6 7836b1e6

Merge branch 'master' of archives.plil.fr:LeClubInfo/etunicorn-server

.idea/dataSources.local.xml deleted
... ... @@ -1,11 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<project version="4">
3   - <component name="dataSourceStorageLocal">
4   - <data-source name="etunicorn.db" uuid="7ff25d0f-17b0-48bb-a8e6-be9293e5e8dc">
5   - <database-info product="SQLite" version="3.8.11" jdbc-version="2.1" driver-name="SQLiteJDBC" driver-version="native" />
6   - <case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
7   - <secret-storage>master_key</secret-storage>
8   - <auth-required>false</auth-required>
9   - </data-source>
10   - </component>
11   -</project>
12 0 \ No newline at end of file
.idea/dataSources.xml deleted
... ... @@ -1,14 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<project version="4">
3   - <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
4   - <data-source source="LOCAL" name="etunicorn.db" uuid="7ff25d0f-17b0-48bb-a8e6-be9293e5e8dc">
5   - <driver-ref>sqlite.xerial</driver-ref>
6   - <synchronize>true</synchronize>
7   - <jdbc-driver>org.sqlite.JDBC</jdbc-driver>
8   - <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/etunicorn.db</jdbc-url>
9   - <driver-properties>
10   - <property name="enable_load_extension" value="true" />
11   - </driver-properties>
12   - </data-source>
13   - </component>
14   -</project>
15 0 \ No newline at end of file
etunicorn-server.iml
... ... @@ -82,9 +82,8 @@
82 82 <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
83 83 <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
84 84 <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" />
85   - <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.40" level="project" />
  85 + <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.6" level="project" />
86 86 <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.3" level="project" />
87   - <orderEntry type="library" name="Maven: com.h2database:h2:1.4.193" level="project" />
88 87 <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.4.RELEASE" level="project" />
89 88 <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" />
90 89 </component>
... ...
... ... @@ -34,6 +34,7 @@
34 34 <dependency>
35 35 <groupId>mysql</groupId>
36 36 <artifactId>mysql-connector-java</artifactId>
  37 + <version>5.1.6</version>
37 38 </dependency>
38 39  
39 40 <dependency>
... ... @@ -42,10 +43,6 @@
42 43 <version>2.3</version>
43 44 </dependency>
44 45 <dependency>
45   - <groupId>com.h2database</groupId>
46   - <artifactId>h2</artifactId>
47   - </dependency>
48   - <dependency>
49 46 <groupId>org.springframework.boot</groupId>
50 47 <artifactId>spring-boot-autoconfigure</artifactId>
51 48 <version>1.4.4.RELEASE</version>
... ...
src/main/java/etunicorn/Application.java
1 1 package etunicorn;
2 2  
3 3 import etunicorn.entity.Permission;
4   -import etunicorn.entity.Personne;
5   -import etunicorn.entity.Role;
6   -import etunicorn.entity.Session;
7 4 import etunicorn.repository.PermissionRepository;
8 5 import etunicorn.repository.PersonneRepository;
9 6 import etunicorn.repository.RoleRepository;
... ... @@ -13,18 +10,15 @@ import org.springframework.boot.SpringApplication;
13 10 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
14 11 import org.springframework.boot.autoconfigure.SpringBootApplication;
15 12 import org.springframework.context.annotation.Bean;
16   -import org.springframework.context.annotation.Configuration;
  13 +import org.springframework.jdbc.datasource.DriverManagerDataSource;
17 14  
18   -import java.util.ArrayList;
19   -import java.util.Date;
20   -import java.util.List;
  15 +import javax.sql.DataSource;
21 16  
22 17 /**
23 18 * etunicorn-server
24 19 * Copyright © 2017 Le Club Info Polytech Lille
25 20 * Tous droits réservés
26 21 */
27   -@Configuration
28 22 @SpringBootApplication
29 23 @EnableAutoConfiguration
30 24 public class Application {
... ... @@ -52,23 +46,23 @@ public class Application {
52 46 permissionRepository.save(new Permission("ROLE_PERMISSION_REMOVE"));
53 47 // ...
54 48  
55   - roleRepository.save(new Role("admin", (List<Permission>) permissionRepository.findAll()));
56   - roleRepository.save(new Role("etudiant", new ArrayList<>()));
57   - personneRepository.save(new Personne("carte", new Date(), "gbontoux", roleRepository.findByNom("admin")));
58   - sessionRepository.save(new Session(personneRepository.findByLogin("gbontoux"), "A", new Date(new Date().getTime() + 1000 * 60 * 10)));
  49 + //roleRepository.save(new Role("admin", (List<Permission>) permissionRepository.findAll()));
  50 + //roleRepository.save(new Role("etudiant", new ArrayList<>()));
  51 + //personneRepository.save(new Personne("546848", new Date(), "bverhaeg", roleRepository.findByNom("admin")));
  52 + //sessionRepository.save(new Session(personneRepository.findByLogin("bverhaeg"), "B", new Date(new Date().getTime() + 1000 * 60 * 10)));
59 53  
60 54 };
61 55 }
62 56  
63   - // @Bean
64   - // public DataSource dataSource() {
65   - // DriverManagerDataSource dataSource = new DriverManagerDataSource();
66   - // dataSource.setDriverClassName("com.mysql.jdbc.Driver");
67   - // dataSource.setUrl("jdbc:mysql://localhost/etunicorn");
68   - // dataSource.setUsername("etunicorn");
69   - // dataSource.setPassword("etunicorn");
70   - // return dataSource;
71   - // }
  57 + @Bean
  58 + public DataSource dataSource() {
  59 + DriverManagerDataSource dataSource = new DriverManagerDataSource();
  60 + dataSource.setDriverClassName("com.mysql.jdbc.Driver");
  61 + dataSource.setUrl("jdbc:mysql://192.168.0.28:3306/bade");
  62 + dataSource.setUsername("bade");
  63 + dataSource.setPassword("bade");
  64 + return dataSource;
  65 + }
72 66  
73 67 // Properties additionalProperties() {
74 68 // Properties properties = new Properties();
... ...
src/main/ressources/application.yml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +spring:
  2 + jpa:
  3 + database-platform: org.hibernate.dialect.MySQL5Dialect
  4 + hibernate:
  5 + ddl-auto: update
0 6 \ No newline at end of file
... ...