Add Spring Security configuration for API Gateway Spring Boot 4 compatibility#509
Add Spring Security configuration for API Gateway Spring Boot 4 compatibility#509yousfiSaad wants to merge 1 commit intospring-petclinic:mainfrom
Conversation
…tibility ## Summary This PR adds required Spring Security configuration for the API Gateway when using Spring Boot 4 with spring-boot-starter-security dependency. ## Problem Spring Boot 4 requires explicit security configuration when spring-boot-starter-security is present. Without it, the default security filters block all requests. ## Solution Add SecurityConfig that permits all requests for the demo application while disabling default security filters (httpBasic, formLogin, csrf, cors). ## Changes - spring-petclinic-api-gateway/pom.xml: Add spring-boot-starter-security dependency - spring-petclinic-api-gateway/src/main/java/.../api/config/SecurityConfig.java: NEW ## Related Issues Related to spring-petclinic#306
|
|
Thank you for your pull request, @yousfiSaad. The issue (#306) does not seem to affect the Spring Boot UI. I don't understand what problem you are trying to solve. |
|
Hi @arey, thank you for the review! I believe there may be some confusion between PR #508 (Spring Boot Admin) and this PR #509 (API Gateway Security). These are two separate pull requests addressing different issues: PR #509 (This PR) - API Gateway Security ConfigurationThis PR adds required Spring Security configuration for the API Gateway specifically (not Spring Boot Admin). The problem this solves: Evidence of the issue:
The solution: |
|
Sorry, but I don't see the point of this PR because the app isn't using the spring-boot-starter-security. Am I missing something? |
|
@arey You're absolutely right - I apologize for the confusion. After further investigation, I discovered that My original diagnosis was incorrect. The issue I was trying to solve was:
This PR should be closed as it addresses a non-existent problem. Thank you for catching this! For context, I was investigating why the API Gateway requires authentication on certain routes, but that's a separate issue unrelated to Spring Boot 4 security requirements. |



Summary
This PR adds required Spring Security configuration for the API Gateway when
using Spring Boot 4 with spring-boot-starter-security dependency.
Problem
Spring Boot 4 requires explicit security configuration when spring-boot-starter-security
is present. Without it, the default security filters block all requests.
Solution
Add SecurityConfig that permits all requests for the demo application while
disabling default security filters (httpBasic, formLogin, csrf, cors).
Changes
spring-petclinic-api-gateway/pom.xml: Add spring-boot-starter-security dependencyspring-petclinic-api-gateway/src/main/java/.../api/config/SecurityConfig.java: NEWRelated Issues
Related to #306