Skip to content

Commit a5beda7

Browse files
committed
feat: ajustes devido ao db postgres #64
1 parent b6f51ce commit a5beda7

File tree

5 files changed

+53
-46
lines changed

5 files changed

+53
-46
lines changed

pom.xml

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
6+
<parent>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>2.7.11</version>
10+
<relativePath/> <!-- lookup parent from repository -->
11+
</parent>
12+
713
<groupId>br.ufrn.dct</groupId>
814
<artifactId>apf-bsi</artifactId>
915
<version>0.0.1-SNAPSHOT</version>
@@ -44,7 +50,7 @@
4450
<properties>
4551
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4652
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
47-
<java.version>11</java.version>
53+
<java.version>17</java.version>
4854
<sonar.organization>tacianosilva-github</sonar.organization>
4955
<sonar.language>java</sonar.language>
5056
<sonar.java.source>java</sonar.java.source>
@@ -54,78 +60,76 @@
5460
</properties>
5561

5662
<dependencies>
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-starter</artifactId>
66+
</dependency>
67+
<dependency>
68+
<groupId>org.springframework.boot</groupId>
69+
<artifactId>spring-boot-starter-test</artifactId>
70+
<scope>test</scope>
71+
</dependency>
5772
<dependency>
5873
<groupId>org.springframework.boot</groupId>
5974
<artifactId>spring-boot-starter-data-jdbc</artifactId>
60-
<version>2.1.5.RELEASE</version>
6175
</dependency>
6276
<dependency>
6377
<groupId>org.springframework.boot</groupId>
6478
<artifactId>spring-boot-starter-data-jpa</artifactId>
65-
<version>2.1.5.RELEASE</version>
6679
</dependency>
6780
<dependency>
6881
<groupId>org.springframework.boot</groupId>
69-
<artifactId>spring-boot-starter-security</artifactId>
70-
<version>2.1.5.RELEASE</version>
82+
<artifactId>spring-boot-starter-validation</artifactId>
7183
</dependency>
7284
<dependency>
7385
<groupId>org.springframework.boot</groupId>
74-
<artifactId>spring-boot-starter</artifactId>
75-
<version>2.1.5.RELEASE</version>
86+
<artifactId>spring-boot-starter-security</artifactId>
7687
</dependency>
7788
<dependency>
7889
<groupId>org.springframework.boot</groupId>
7990
<artifactId>spring-boot-starter-thymeleaf</artifactId>
80-
<version>2.1.5.RELEASE</version>
8191
</dependency>
8292
<dependency>
8393
<groupId>org.springframework.boot</groupId>
8494
<artifactId>spring-boot-starter-web</artifactId>
85-
<version>2.1.5.RELEASE</version>
8695
<exclusions>
8796
<exclusion>
8897
<groupId>org.springframework.boot</groupId>
8998
<artifactId>spring-boot-starter-logging</artifactId>
9099
</exclusion>
91100
</exclusions>
92101
</dependency>
93-
102+
<dependency>
103+
<groupId>org.springframework.boot</groupId>
104+
<artifactId>spring-boot-starter-log4j2</artifactId>
105+
</dependency>
94106
<dependency>
95107
<groupId>org.springframework.boot</groupId>
96108
<artifactId>spring-boot-devtools</artifactId>
97-
<version>2.1.5.RELEASE</version>
98109
<optional>true</optional>
99110
</dependency>
100111

101112
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
102113
<dependency>
103114
<groupId>org.postgresql</groupId>
104115
<artifactId>postgresql</artifactId>
105-
<version>42.5.0</version>
106-
</dependency>
107-
<dependency>
108-
<groupId>org.springframework.boot</groupId>
109-
<artifactId>spring-boot-starter-test</artifactId>
110-
<version>2.1.5.RELEASE</version>
111-
<scope>test</scope>
116+
<version>42.6.0</version>
112117
</dependency>
113118
<dependency>
114119
<groupId>com.h2database</groupId>
115120
<artifactId>h2</artifactId>
116-
<version>1.4.196</version>
117121
<scope>test</scope>
118122
</dependency>
119-
<dependency>
123+
<!-- dependency>
120124
<groupId>net.sourceforge.nekohtml</groupId>
121125
<artifactId>nekohtml</artifactId>
122-
<version>1.9.21</version><!--$NO-MVN-MAN-VER$ -->
123-
</dependency>
126+
<version>1.9.22</version>
127+
</dependency -->
124128

125129
<dependency>
126130
<groupId>org.testng</groupId>
127131
<artifactId>testng</artifactId>
128-
<version>6.13.1</version>
132+
<version>6.14.3</version>
129133
<scope>test</scope>
130134
</dependency>
131135

@@ -135,16 +139,10 @@
135139
<version>2.3.0</version>
136140
</dependency>
137141

138-
<dependency>
139-
<groupId>org.springframework.boot</groupId>
140-
<artifactId>spring-boot-starter-log4j2</artifactId>
141-
<version>2.1.5.RELEASE</version>
142-
</dependency>
143-
144142
<dependency>
145143
<groupId>org.modelmapper</groupId>
146144
<artifactId>modelmapper</artifactId>
147-
<version>2.3.4</version>
145+
<version>3.1.1</version>
148146
</dependency>
149147
</dependencies>
150148

@@ -162,7 +160,6 @@
162160
<plugin>
163161
<groupId>org.springframework.boot</groupId>
164162
<artifactId>spring-boot-maven-plugin</artifactId>
165-
<version>2.1.5.RELEASE</version>
166163
<executions>
167164
<execution>
168165
<goals>
@@ -179,7 +176,7 @@
179176
<plugin>
180177
<groupId>org.jacoco</groupId>
181178
<artifactId>jacoco-maven-plugin</artifactId>
182-
<version>0.8.3</version>
179+
<version>0.8.10</version>
183180
<executions>
184181
<execution>
185182
<goals>
@@ -294,7 +291,7 @@
294291
<plugin>
295292
<groupId>org.jacoco</groupId>
296293
<artifactId>jacoco-maven-plugin</artifactId>
297-
<version>0.8.1</version>
294+
<version>0.8.10</version>
298295
</plugin>
299296
</plugins>
300297
</reporting>

src/main/java/br/ufrn/dct/apf/model/User.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.springframework.data.annotation.Transient;
2323

2424
@Entity
25-
@Table(name = "user")
25+
@Table(name = "users")
2626
public class User implements Serializable {
2727

2828
/**

src/main/java/br/ufrn/dct/apf/repository/ProjectRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@Repository("projectRepository")
1313
public interface ProjectRepository extends JpaRepository<Project, Long> {
1414

15-
@Query(value = "SELECT * FROM apf.project p, apf.member m where p.project_id = m.project_id and m.user_id = :userId", nativeQuery=true)
15+
@Query(value = "SELECT * FROM project p, member m where p.project_id = m.project_id and m.user_id = :userId", nativeQuery=true)
1616
List<Project> findByUserId(@Param("userId") Long userId);
1717

1818
List<Project> findByNameContaining(String name);

src/main/resources/application.properties

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
# = DATA SOURCE
33
# ===============================
44
spring.datasource.url=jdbc:postgresql://localhost:5432/apf_db
5+
spring.datasource.name=apf_db
56
spring.datasource.username=apf_user
67
spring.datasource.password=12345
7-
spring.datasource.testWhileIdle=true
8-
spring.datasource.validationQuery=SELECT 1
9-
spring.datasource.driverclassname=org.postgresql.Driver
10-
spring.datasource.continueOnError=true
8+
spring.datasource.driver-class-name=org.postgresql.Driver
9+
spring.data.jpa.repositories.bootstrap-mode=default
1110

1211
# ===============================
1312
# = JPA / HIBERNATE
1413
# ===============================
15-
spring.jpa.properties.hibernate.default_schema=apf
14+
# spring.jpa.properties.hibernate.default_schema=apf
1615
spring.jpa.show-sql=true
17-
#spring.jpa.properties.hibernate.format_sql=true
18-
spring.jpa.hibernate.ddl-auto=update
16+
spring.jpa.properties.hibernate.format_sql=true
17+
spring.jpa.defer-datasource-initialization=true
18+
spring.sql.init.continue-on-error=true
19+
20+
spring.jpa.hibernate.ddl-auto=create
1921
#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
2022
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
2123
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
@@ -27,6 +29,9 @@ logging.level.br.ufrn.dct.apf=DEBUG
2729
#logging.level.org.hibernate.SQL=DEBUG
2830
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
2931

32+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
33+
spring.jpa.properties.hibernate.globally_quoted_identifiers_skip_column_definitions = true
34+
3035
# ===============================
3136
# = Thymeleaf configurations
3237
# ===============================
@@ -40,15 +45,15 @@ spring.thymeleaf.cache=false
4045
# Context path of the application.
4146
server.servlet.context-path=/apf
4247
# Display name of the application.
43-
server.display-name=Analisador de Pontos de Função
48+
server.servlet.application-display-name=Analisador de Pontos de Função
4449
# Define server port.
4550
server.port=8080
4651

4752
# ==============================================================
4853
# = Spring Security / Queries for AuthenticationManagerBuilder
4954
# ==============================================================
50-
spring.queries.users-query=select email, password, active from apf.user where email=?
51-
spring.queries.roles-query=select u.email, r.role_name from apf.user u inner join apf.user_role ur on(u.user_id=ur.user_id) inner join apf.role r on(ur.role_id=r.role_id) where u.email=?
55+
spring.queries.users-query=select email, password, active from users where email=?
56+
spring.queries.roles-query=select u.email, r.role_name from users u inner join user_role ur on(u.user_id=ur.user_id) inner join role r on(ur.role_id=r.role_id) where u.email=?
5257

5358
# =============================================================
5459
# = Spring General

src/main/resources/data.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO role VALUES (1,'ADMIN');
2+
INSERT INTO role VALUES (2,'USER');
3+
4+
INSERT INTO attribution VALUES (1,'PROJECT MANAGER');
5+
INSERT INTO attribution VALUES (2,'PROJECT MEMBER');

0 commit comments

Comments
 (0)