Bonjour mes amis
Je suis entrain de développer un projet : la sécurité des application web en utilisant Spring Security. J'ai créé l'entité
Et j'ai créé le fichier de configuration application.proprietes
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 package org.sid.entities; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @SuppressWarnings("serial") public class Etudiant implements Serializable { @Id @GeneratedValue private Long idEtudiant; @Column(name = "NOM", length = 80) private String nom; @Column(name = "PRENOM", length = 80) private String prenom; @Temporal(TemporalType.DATE) private Date dateNaissance; public Long getIdEtudiant() { return idEtudiant; } public void setIdEtudiant(Long idEtudiant) { this.idEtudiant = idEtudiant; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getPrenom() { return prenom; } public void setPrenom(String prenom) { this.prenom = prenom; } public Date getDateNaissance() { return dateNaissance; } public void setDateNaissance(Date dateNaissance) { this.dateNaissance = dateNaissance; } public Etudiant() { super(); } public Etudiant(String nom, String prenom, Date dateNaissance) { super(); this.nom = nom; this.prenom = prenom; this.dateNaissance = dateNaissance; } }
j'ai créé l'interface repository
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 spring.datasource.url = jdbc:mysql://localhost:3306/springbd spring.datasource.username = root spring.datasource.password = spring.datasource.driverClassName = com.mysql.jdbc.Driver spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto = create spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
et le contrôleur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 package org.sid.dao; import org.sid.entities.Etudiant; import org.springframework.data.jpa.repository.JpaRepository; public interface IEtudiantRepository extends JpaRepository<Etudiant, Long> { }
Et voila le fichier pom.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 package org.sid.service; import org.sid.dao.IEtudiantRepository; import org.sid.entities.Etudiant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController public class EtudiantRestService { @Autowired private IEtudiantRepository etudiantRepository; @RequestMapping(value = "/saveEtudiant", method = RequestMethod.GET) public Etudiant saveEtudiant(Etudiant et) { return etudiantRepository.save(et); } @RequestMapping(value = "/etudiants", method = RequestMethod.GET) public Page<Etudiant> listEtudiant(int page, int size) { return etudiantRepository.findAll(new PageRequest(page, size)); } }
le problème est due au l'ajout de dépendance sécurité quelle que soit la condition au début de création du projet ou l'ajout de dépendance après la création du projet.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.sid</groupId> <artifactId>faculty</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Scolarite</name> <description>Mon projert spring boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.8.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-cassandra</artifactId> </dependency> <dependency> <groupId>org.springframework.integration</groupId> <artifactId>spring-integration-http</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
j'ai essayé de faire menu->Project -> Clean... aucun effet
Projet->Build Path -> Libraries -> JRE SystemLibrary -> Remove en suite Add Library.. -> JRE System Library ->Next -> WorkSpace default JRE -> finish => le point d'exclamation toujours afficher
Fermer le projet -> double clique sur le projet => le problème n'est pas résolue
Toujours la fenêtre Problems afficher 2 erreur
la première erreur est :
et la deuxième
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Archive for required library: 'C:/Users/Wajihov/.m2/repository/io/netty/netty-transport/4.0.37.Final/netty-transport-4.0.37.Final.jar' in project 'Scolarite' cannot be read or is not a valid ZIP file
je suis bloqué depuis deux jours SVP aider moi c'est très urgent et merci d'avance pour vos idées et vos commentaires mes amis
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 The project cannot be built until build path errors are resolved
Partager