XENTRIAC - CEFTRIAXONA
Thursday, December 4, 2025
Friday, August 8, 2025
WebFlux CORS error
Hi:
I tried to use Spring Web Gateway Configuration and the follow problem occur using Spring Webflux:
-----------------------
"from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed", spring cloud gateway
----------------------
The solution was to use predicates of Spring Webflux instead:
-------------------
server:
port: 7002
eureka:
instance:
hostname: localhost
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8761/eureka/
spring:
application:
name: server-gateway
cloud:
gateway:
server:
webflux:
routes:
- id : service-envio
uri: lb://abc
predicates:
- Path=/senvios/**
filters:
- RewritePath=/senvios/*, /
default-filters:
- DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE
globalcors:
cors-configurations:
'[/**]':
allowedorigins: "*"
allowedmethods: "*"
allowedheaders: "*"
allowed-credentials: true
-------------------
Best Regards,
Friday, July 25, 2025
Error of Shared classes at Junit Test
After upgrade of JDK, I was using JDK-17 and in JUnit Test an error appear with the following description:
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
The solution to this warning was to add a flag as an argument in STS/Eclipse at VM arguments in JUnit Test, the flag is the following below:
-Xshare:off
Best regards,