Commit 7836b1e6eaeab81f9d4d74778d8907914fd15a8d
1 parent
c4e83d00
To MySQLDatabase
Showing
6 changed files
with
22 additions
and
52 deletions
Show diff stats
.idea/dataSources.local.xml deleted
@@ -1,11 +0,0 @@ | @@ -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 | \ No newline at end of file | 0 | \ No newline at end of file |
.idea/dataSources.xml deleted
@@ -1,14 +0,0 @@ | @@ -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 | \ No newline at end of file | 0 | \ No newline at end of file |
etunicorn-server.iml
@@ -82,9 +82,8 @@ | @@ -82,9 +82,8 @@ | ||
82 | <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> | 82 | <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> |
83 | <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> | 83 | <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> |
84 | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" /> | 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 | <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.3" level="project" /> | 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 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.4.RELEASE" level="project" /> | 87 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.4.RELEASE" level="project" /> |
89 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" /> | 88 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" /> |
90 | </component> | 89 | </component> |
pom.xml
@@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
34 | <dependency> | 34 | <dependency> |
35 | <groupId>mysql</groupId> | 35 | <groupId>mysql</groupId> |
36 | <artifactId>mysql-connector-java</artifactId> | 36 | <artifactId>mysql-connector-java</artifactId> |
37 | + <version>5.1.6</version> | ||
37 | </dependency> | 38 | </dependency> |
38 | 39 | ||
39 | <dependency> | 40 | <dependency> |
@@ -42,10 +43,6 @@ | @@ -42,10 +43,6 @@ | ||
42 | <version>2.3</version> | 43 | <version>2.3</version> |
43 | </dependency> | 44 | </dependency> |
44 | <dependency> | 45 | <dependency> |
45 | - <groupId>com.h2database</groupId> | ||
46 | - <artifactId>h2</artifactId> | ||
47 | - </dependency> | ||
48 | - <dependency> | ||
49 | <groupId>org.springframework.boot</groupId> | 46 | <groupId>org.springframework.boot</groupId> |
50 | <artifactId>spring-boot-autoconfigure</artifactId> | 47 | <artifactId>spring-boot-autoconfigure</artifactId> |
51 | <version>1.4.4.RELEASE</version> | 48 | <version>1.4.4.RELEASE</version> |
src/main/java/etunicorn/Application.java
1 | package etunicorn; | 1 | package etunicorn; |
2 | 2 | ||
3 | import etunicorn.entity.Permission; | 3 | import etunicorn.entity.Permission; |
4 | -import etunicorn.entity.Personne; | ||
5 | -import etunicorn.entity.Role; | ||
6 | -import etunicorn.entity.Session; | ||
7 | import etunicorn.repository.PermissionRepository; | 4 | import etunicorn.repository.PermissionRepository; |
8 | import etunicorn.repository.PersonneRepository; | 5 | import etunicorn.repository.PersonneRepository; |
9 | import etunicorn.repository.RoleRepository; | 6 | import etunicorn.repository.RoleRepository; |
@@ -13,18 +10,15 @@ import org.springframework.boot.SpringApplication; | @@ -13,18 +10,15 @@ import org.springframework.boot.SpringApplication; | ||
13 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | 10 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
14 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
15 | import org.springframework.context.annotation.Bean; | 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 | * etunicorn-server | 18 | * etunicorn-server |
24 | * Copyright © 2017 Le Club Info Polytech Lille | 19 | * Copyright © 2017 Le Club Info Polytech Lille |
25 | * Tous droits réservés | 20 | * Tous droits réservés |
26 | */ | 21 | */ |
27 | -@Configuration | ||
28 | @SpringBootApplication | 22 | @SpringBootApplication |
29 | @EnableAutoConfiguration | 23 | @EnableAutoConfiguration |
30 | public class Application { | 24 | public class Application { |
@@ -52,23 +46,23 @@ public class Application { | @@ -52,23 +46,23 @@ public class Application { | ||
52 | permissionRepository.save(new Permission("ROLE_PERMISSION_REMOVE")); | 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 | // Properties additionalProperties() { | 67 | // Properties additionalProperties() { |
74 | // Properties properties = new Properties(); | 68 | // Properties properties = new Properties(); |