diff --git a/README.md b/README.md
index b83999c..cc5317c 100644
--- a/README.md
+++ b/README.md
@@ -12,4 +12,13 @@
- IDE: IntelliJ
- Documentação da API:
- Banco de Dados: MySQL 8
-- AI utilizada para auxilio documentação do Projeto [Codeium](https://codeium.com/profile/gabryelboeira)
\ No newline at end of file
+- Docker
+- AI utilizada para auxilio documentação do Projeto [Codeium](https://codeium.com/profile/gabryelboeira)
+
+
+## Informações para a execução do projeto:
+
+- Acessar a raiz do projeto em VideoLocadora/, execurta o seguinde comando para executar o projeto
+```
+ docker-compose up --build -d
+```
\ No newline at end of file
diff --git a/VideoLocadora/.dockerignore b/VideoLocadora/.dockerignore
new file mode 100644
index 0000000..8620276
--- /dev/null
+++ b/VideoLocadora/.dockerignore
@@ -0,0 +1,5 @@
+.idea
+.gitignore
+HELP.md
+mvnw*
+.mvn
\ No newline at end of file
diff --git a/VideoLocadora/.gitignore b/VideoLocadora/.gitignore
index 549e00a..08c9d6d 100644
--- a/VideoLocadora/.gitignore
+++ b/VideoLocadora/.gitignore
@@ -2,7 +2,8 @@ HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
-!**/src/test/**/target/
+!**/src/test/**/target
+*~
### STS ###
.apt_generated
diff --git a/VideoLocadora/Dockerfile b/VideoLocadora/Dockerfile
new file mode 100644
index 0000000..d35454d
--- /dev/null
+++ b/VideoLocadora/Dockerfile
@@ -0,0 +1,4 @@
+FROM openjdk:21
+EXPOSE 8080
+COPY target/*.jar app.jar
+ENTRYPOINT ["java","-jar","/app.jar"]
diff --git a/VideoLocadora/docker-compose.yml b/VideoLocadora/docker-compose.yml
new file mode 100644
index 0000000..ab0d9c6
--- /dev/null
+++ b/VideoLocadora/docker-compose.yml
@@ -0,0 +1,22 @@
+version: '3.8'
+
+services:
+ db:
+ image: mysql:8.0
+ environment:
+ MYSQL_ROOT_PASSWORD: root
+ MYSQL_DATABASE: videolocadora
+ ports:
+ - "3306:3306"
+ restart: always
+
+ app:
+ build: .
+ ports:
+ - "8080:8080"
+ depends_on:
+ - db
+ environment:
+ SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/videolocadora
+ SPRING_DATASOURCE_USERNAME: root
+ SPRING_DATASOURCE_PASSWORD: root
\ No newline at end of file
diff --git a/VideoLocadora/pom.xml b/VideoLocadora/pom.xml
index 53eae6d..18526cf 100644
--- a/VideoLocadora/pom.xml
+++ b/VideoLocadora/pom.xml
@@ -5,8 +5,8 @@
org.springframework.boot
spring-boot-starter-parent
- 3.3.4
-
+ 3.3.6
+
io.github.gabryel
@@ -38,6 +38,17 @@
spring-boot-starter-validation
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.springframework.boot
+ spring-boot-docker-compose
+ 3.1.1
+
+
org.springframework.boot
spring-boot-devtools
@@ -89,6 +100,11 @@
2.6.0
+
+ org.mapstruct
+ mapstruct
+ 1.6.3
+
@@ -97,9 +113,11 @@
true
development
+
jar
compile
+ true
@@ -109,16 +127,36 @@
org.springframework.boot
spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
-
-
+
+ 11
+
+
org.projectlombok
lombok
-
-
+ 1.18.36
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.6.3
+
+
+ org.projectlombok
+ lombok-mapstruct-binding
+ 0.2.0
+
+
+
+
diff --git a/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/configuration/Messages.java b/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/configuration/Messages.java
index ab77ff8..9faa060 100644
--- a/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/configuration/Messages.java
+++ b/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/configuration/Messages.java
@@ -7,8 +7,6 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
-import org.springframework.web.servlet.LocaleResolver;
-import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import java.util.Locale;
@@ -17,13 +15,10 @@
@Configuration
public class Messages {
- @Value("${spring.messages.default-locale}")
- private String defaultLocale;
+ public static final String DEFAULT_LOCALE = "pt-BR";
- @Bean
- public LocaleResolver localeResolver() {
- return new SessionLocaleResolver();
- }
+ @Value("${spring.messages.default-locale}")
+ private String localeSelected;
@Bean(name="messageSource")
public ResourceBundleMessageSource messageSource() {
@@ -58,10 +53,10 @@ public String getMessage(String message) {
* @return the retrieved message, or an empty string if the message code is blank or the message source is not found
*/
public String getMessage(String message, Object... args) {
- if (StringUtils.isNotBlank(defaultLocale)) defaultLocale = "pt-BR";
+ if (StringUtils.isNotBlank(localeSelected)) localeSelected = DEFAULT_LOCALE;
if (StringUtils.isNotBlank(message))
- return messageSource().getMessage(message, args, Locale.forLanguageTag(defaultLocale));
+ return messageSource().getMessage(message, args, Locale.forLanguageTag(localeSelected));
return "";
}
diff --git a/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/controller/CustomerController.java b/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/controller/CustomerController.java
index fc66ce8..93f188e 100644
--- a/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/controller/CustomerController.java
+++ b/VideoLocadora/src/main/java/io/github/gabryel/videolocadora/controller/CustomerController.java
@@ -1,10 +1,12 @@
package io.github.gabryel.videolocadora.controller;
+import io.github.gabryel.videolocadora.dto.customer.CustomerDetailDTO;
import io.github.gabryel.videolocadora.exception.BusinessException;
import io.github.gabryel.videolocadora.service.customer.CustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -12,13 +14,16 @@
import org.springframework.web.bind.annotation.RestController;
@RestController
-@AllArgsConstructor
@RequestMapping("/customer")
@Tag(name = "Cliente", description = "Gerenciar/Manipular dados de clientes")
public class CustomerController {
private final CustomerService customerService;
+ public CustomerController(CustomerService customerService) {
+ this.customerService = customerService;
+ }
+
@GetMapping("/")
public String index() {
return "Hello World";
@@ -26,7 +31,7 @@ public String index() {
@Operation(summary = "Buscar cliente por ID")
@GetMapping("/{id}")
- public ResponseEntity