diff --git a/pom.xml b/pom.xml
index 6bad6857..48cb5c45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,13 +6,13 @@
4.0.0
org.opencommercial
api
- 1.3.17
+ 1.4.0
jar
org.springframework.boot
spring-boot-starter-parent
- 3.3.7
+ 4.0.1
@@ -23,16 +23,17 @@
1.6.1
6.17.0
3.17
- 0.12.6
+ 0.13.0
1.46
2.14.0
1.4.0
3.0.4
1.39.0
- 8.17.0
+ 8.25.1
2.1.4
2.8.9
- 2.2.1
+ 2.3.0
+ 5.1.0
src/main/java/org/opencommercial/model/**,
src/main/java/org/opencommercial/exception/**
@@ -64,15 +65,11 @@
lombok
provided
-
- org.mockito
- mockito-core
-
com.querydsl
querydsl-apt
- ${querydsl.version}
provided
+ ${querydsl.version}
jakarta
@@ -129,7 +126,7 @@
org.springframework.boot
- spring-boot-starter-web
+ spring-boot-starter-webmvc
org.springframework.boot
@@ -139,6 +136,10 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ org.springframework.boot
+ spring-boot-starter-cache
+
org.springframework.boot
spring-boot-starter-mail
@@ -167,6 +168,11 @@
spring-boot-starter-test
test
+
+ org.springframework.boot
+ spring-boot-test-autoconfigure
+ test
+
org.springframework.boot
spring-boot-testcontainers
@@ -174,12 +180,32 @@
org.testcontainers
- junit-jupiter
+ testcontainers-junit-jupiter
test
org.testcontainers
- mysql
+ testcontainers-mysql
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-webmvc-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-restclient-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-cache-test
test
diff --git a/src/main/java/org/opencommercial/App.java b/src/main/java/org/opencommercial/App.java
index 2010ecd6..782ab118 100644
--- a/src/main/java/org/opencommercial/App.java
+++ b/src/main/java/org/opencommercial/App.java
@@ -2,14 +2,12 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@EnableAsync
-@EnableCaching
public class App {
public static void main(String[] args) {
diff --git a/src/main/java/org/opencommercial/config/AppConfig.java b/src/main/java/org/opencommercial/config/AppConfig.java
index a4ae8452..29446381 100644
--- a/src/main/java/org/opencommercial/config/AppConfig.java
+++ b/src/main/java/org/opencommercial/config/AppConfig.java
@@ -1,12 +1,12 @@
package org.opencommercial.config;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.Module;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.module.SimpleModule;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
+import org.opencommercial.model.Cliente;
+import org.opencommercial.model.Ubicacion;
+import org.opencommercial.model.dto.ClienteDTO;
+import org.opencommercial.model.dto.UbicacionDTO;
+import org.opencommercial.service.AfipWebServiceSOAPClient;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -17,41 +17,39 @@
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
-import org.opencommercial.model.Cliente;
-import org.opencommercial.model.Ubicacion;
-import org.opencommercial.model.dto.ClienteDTO;
-import org.opencommercial.model.dto.UbicacionDTO;
-import org.opencommercial.service.AfipWebServiceSOAPClient;
+import tools.jackson.core.JacksonException;
+import tools.jackson.core.JsonGenerator;
+import tools.jackson.databind.SerializationContext;
+import tools.jackson.databind.ValueSerializer;
+import tools.jackson.databind.module.SimpleModule;
-import java.io.IOException;
import java.time.Clock;
@Configuration
public class AppConfig {
@Bean
- public Module springDataPageModule() {
+ public SimpleModule springDataPageModule() {
return new SimpleModule()
- .addSerializer(
- Page.class,
- new JsonSerializer() {
- @Override
- public void serialize(Page value, JsonGenerator gen, SerializerProvider serializers)
- throws IOException {
- gen.writeStartObject();
- gen.writeNumberField("totalElements", value.getTotalElements());
- gen.writeNumberField("totalPages", value.getTotalPages());
- gen.writeNumberField("number", value.getNumber());
- gen.writeNumberField("numberOfElements", value.getNumberOfElements());
- gen.writeNumberField("size", value.getSize());
- gen.writeBooleanField("first", value.isFirst());
- gen.writeBooleanField("last", value.isLast());
- gen.writeFieldName("content");
- serializers.defaultSerializeValue(value.getContent(), gen);
- gen.writeObjectField("sort", value.getSort());
- gen.writeEndObject();
- }
- });
+ .addSerializer(
+ Page.class,
+ new ValueSerializer() {
+
+ @Override
+ public void serialize(Page value, JsonGenerator gen, SerializationContext sc) throws JacksonException {
+ gen.writeStartObject();
+ gen.writeNumberProperty("totalElements", value.getTotalElements());
+ gen.writeNumberProperty("totalPages", value.getTotalPages());
+ gen.writeNumberProperty("number", value.getNumber());
+ gen.writeNumberProperty("numberOfElements", value.getNumberOfElements());
+ gen.writeNumberProperty("size", value.getSize());
+ gen.writeBooleanProperty("first", value.isFirst());
+ gen.writeBooleanProperty("last", value.isLast());
+ sc.defaultSerializeProperty("content", value.getContent(), gen);
+ gen.writePOJOProperty("sort", value.getSort());
+ gen.writeEndObject();
+ }
+ });
}
@Bean
diff --git a/src/main/java/org/opencommercial/config/CacheConfig.java b/src/main/java/org/opencommercial/config/CacheConfig.java
new file mode 100644
index 00000000..ca4682aa
--- /dev/null
+++ b/src/main/java/org/opencommercial/config/CacheConfig.java
@@ -0,0 +1,17 @@
+package org.opencommercial.config;
+
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@EnableCaching
+public class CacheConfig {
+
+ @Bean
+ public CacheManager cacheManager() {
+ return new ConcurrentMapCacheManager();
+ }
+}
diff --git a/src/main/java/org/opencommercial/config/SecurityJsonViewControllerAdvice.java b/src/main/java/org/opencommercial/config/SecurityJsonViewControllerAdvice.java
index 7f1a60c2..934a49b1 100644
--- a/src/main/java/org/opencommercial/config/SecurityJsonViewControllerAdvice.java
+++ b/src/main/java/org/opencommercial/config/SecurityJsonViewControllerAdvice.java
@@ -1,20 +1,28 @@
package org.opencommercial.config;
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.servlet.http.HttpServletRequest;
+import org.jspecify.annotations.NonNull;
+import org.opencommercial.model.Rol;
+import org.opencommercial.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
-import org.springframework.http.converter.json.MappingJacksonValue;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.RestControllerAdvice;
-import org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJacksonResponseBodyAdvice;
-import org.opencommercial.model.Rol;
-import org.opencommercial.service.AuthService;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
@RestControllerAdvice
-public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResponseBodyAdvice {
+public class SecurityJsonViewControllerAdvice implements ResponseBodyAdvice