Skip to content

Commit daf142d

Browse files
committed
Atualizar dependências
1 parent 97ef9ce commit daf142d

File tree

5 files changed

+44
-45
lines changed

5 files changed

+44
-45
lines changed

pom.xml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,45 @@
1818
<dependency>
1919
<groupId>org.springframework.boot</groupId>
2020
<artifactId>spring-boot-starter</artifactId>
21-
<version>3.2.6</version>
21+
<version>3.2.12</version>
2222
</dependency>
2323

2424
<dependency>
2525
<groupId>org.springframework</groupId>
2626
<artifactId>spring-context</artifactId>
27-
<version>6.1.11</version>
27+
<version>6.1.15</version>
2828
</dependency>
2929

3030
<dependency>
3131
<groupId>org.springframework.boot</groupId>
3232
<artifactId>spring-boot-starter-data-jpa</artifactId>
33-
<version>3.2.6</version>
33+
<version>3.2.12</version>
3434
</dependency>
3535

3636
<dependency>
3737
<groupId>org.springframework.boot</groupId>
3838
<artifactId>spring-boot-starter-web</artifactId>
39-
<version>3.2.6</version>
39+
<version>3.2.12</version>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-starter-validation</artifactId>
45+
<version>3.2.12</version>
4046
</dependency>
4147

4248
<dependency>
4349
<groupId>org.springframework.boot</groupId>
4450
<artifactId>spring-boot-starter-test</artifactId>
4551
<scope>test</scope>
46-
<version>3.2.6</version>
52+
<version>3.2.12</version>
4753
</dependency>
4854

4955
<dependency>
5056
<groupId>org.junit.vintage</groupId>
5157
<artifactId>junit-vintage-engine</artifactId>
5258
<scope>test</scope>
53-
<version>5.10.3</version>
59+
<version>5.10.5</version>
5460
<exclusions>
5561
<exclusion>
5662
<groupId>org.hamcrest</groupId>
@@ -62,13 +68,13 @@
6268
<dependency>
6369
<groupId>org.hibernate.orm</groupId>
6470
<artifactId>hibernate-community-dialects</artifactId>
65-
<version>6.4.8.Final</version>
71+
<version>6.4.10.Final</version>
6672
</dependency>
6773

6874
<dependency>
6975
<groupId>org.flywaydb</groupId>
7076
<artifactId>flyway-core</artifactId>
71-
<version>10.15.2</version>
77+
<version>11.0.0</version>
7278
</dependency>
7379

7480
<dependency>
@@ -95,39 +101,39 @@
95101
<dependency>
96102
<groupId>org.slf4j</groupId>
97103
<artifactId>slf4j-api</artifactId>
98-
<version>2.0.6</version>
104+
<version>2.0.16</version>
99105
</dependency>
100106

101107
<dependency>
102108
<groupId>org.projectlombok</groupId>
103109
<artifactId>lombok</artifactId>
104-
<version>1.18.34</version>
110+
<version>1.18.36</version>
105111
</dependency>
106112

107113
<dependency>
108114
<groupId>org.xerial</groupId>
109115
<artifactId>sqlite-jdbc</artifactId>
110-
<version>3.46.0.0</version>
116+
<version>3.47.0.0</version>
111117
</dependency>
112118

113119
<dependency>
114120
<groupId>org.seleniumhq.selenium</groupId>
115121
<artifactId>selenium-remote-driver</artifactId>
116-
<version>4.22.0</version>
122+
<version>4.26.0</version>
117123
</dependency>
118124

119125
<dependency>
120126
<groupId>org.seleniumhq.selenium</groupId>
121127
<artifactId>selenium-java</artifactId>
122-
<version>4.22.0</version>
128+
<version>4.26.0</version>
123129
</dependency>
124130
</dependencies>
125131
<build>
126132
<plugins>
127133
<plugin>
128134
<groupId>org.springframework.boot</groupId>
129135
<artifactId>spring-boot-maven-plugin</artifactId>
130-
<version>3.2.6</version>
136+
<version>3.2.12</version>
131137
</plugin>
132138
<plugin>
133139
<groupId>org.apache.maven.plugins</groupId>

src/main/java/br/dev/modscleo4/Main.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,14 @@
1616

1717
package br.dev.modscleo4;
1818

19-
import javax.sql.DataSource;
20-
21-
import org.springframework.beans.factory.annotation.Autowired;
2219
import org.springframework.boot.SpringApplication;
2320
import org.springframework.boot.autoconfigure.SpringBootApplication;
24-
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
25-
import org.springframework.context.annotation.Bean;
26-
import org.springframework.core.env.Environment;
27-
import org.springframework.jdbc.datasource.DriverManagerDataSource;
2821
import org.springframework.scheduling.annotation.EnableScheduling;
2922

30-
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
23+
@SpringBootApplication
3124
@EnableScheduling
3225
public class Main {
33-
@Autowired
34-
Environment env;
35-
3626
public static void main(String[] args) {
3727
SpringApplication.run(Main.class, args);
3828
}
39-
40-
@Bean
41-
public DataSource dataSource() {
42-
final var dataSource = new DriverManagerDataSource();
43-
dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name"));
44-
dataSource.setUrl(env.getProperty("spring.datasource.url"));
45-
dataSource.setUsername(env.getProperty("spring.datasource.username"));
46-
dataSource.setPassword(env.getProperty("spring.datasource.password"));
47-
48-
return dataSource;
49-
}
5029
}

src/main/java/br/dev/modscleo4/marketplace/MercadoLivre.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public String getSearchURL(@Nonnull String query) {
6565
continue;
6666
}
6767

68-
var nameAndURLElement = item.findElement(By.cssSelector("a.ui-search-link__title-card"));
69-
var priceElement = item.findElement(By.cssSelector("span.andes-money-amount__fraction"));
68+
var nameAndURLElement = item.findElement(By.cssSelector("h2.poly-box.poly-component__title a"));
69+
var priceElement = item.findElement(By.cssSelector("div.poly-price__current span.andes-money-amount__fraction"));
7070

7171
var name = nameAndURLElement.getText();
7272
var url = nameAndURLElement.getAttribute("href");

src/main/java/br/dev/modscleo4/product/Product.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,51 @@
1717
package br.dev.modscleo4.product;
1818

1919
import java.io.Serializable;
20+
import java.util.Date;
21+
22+
import org.hibernate.annotations.CreationTimestamp;
23+
import org.hibernate.annotations.UpdateTimestamp;
24+
import org.hibernate.validator.constraints.URL;
2025

2126
import br.dev.modscleo4.marketplace.IMarketplace;
27+
import jakarta.persistence.Column;
2228
import jakarta.persistence.Entity;
2329
import jakarta.persistence.EnumType;
2430
import jakarta.persistence.Enumerated;
2531
import jakarta.persistence.GeneratedValue;
2632
import jakarta.persistence.GenerationType;
2733
import jakarta.persistence.Id;
34+
import jakarta.persistence.Temporal;
35+
import jakarta.persistence.TemporalType;
36+
import jakarta.validation.constraints.DecimalMin;
2837
import lombok.Getter;
2938
import lombok.NoArgsConstructor;
3039
import lombok.Setter;
40+
import lombok.ToString;
3141

3242
@Entity(name = "products")
33-
@Getter @Setter @NoArgsConstructor
43+
@Getter @Setter @NoArgsConstructor @ToString
3444
public class Product implements Serializable {
3545
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
3646
private Long id;
3747
@Enumerated(EnumType.STRING)
3848
private IMarketplace.Marketplace marketplace;
49+
@Column(nullable = false)
3950
private String name;
51+
@URL @Column(nullable = false)
4052
private String url;
53+
@DecimalMin("0.00") @Column(nullable = false)
4154
private double price;
4255

56+
@CreationTimestamp @Temporal(TemporalType.TIMESTAMP)
57+
private Date createdAt;
58+
@UpdateTimestamp @Temporal(TemporalType.TIMESTAMP)
59+
private Date updatedAt;
60+
4361
public Product(IMarketplace.Marketplace marketplace, String name, String url, double price) {
4462
this.marketplace = marketplace;
4563
this.name = name;
4664
this.url = url;
4765
this.price = price;
4866
}
49-
50-
@Override
51-
public String toString() {
52-
return String.format("Product[id=%d, marketplace=%s, name=%s, url=%s, price=%.2f]", id, marketplace, name, url, price);
53-
}
5467
}

src/main/resources/db/migration/V1__create_product_schema.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ CREATE TABLE IF NOT EXISTS products (
44
name TEXT NOT NULL,
55
url TEXT NOT NULL,
66
price REAL NOT NULL,
7-
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
7+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8+
updated_at TIMESTAMP
89
);

0 commit comments

Comments
 (0)