spring-attic / spring-security-saml

SAML extension for the Spring Security project
Other
419 stars 484 forks source link

Dependency cycle with SAMLEntryPoint #518

Open OrangeDog opened 2 years ago

OrangeDog commented 2 years ago

There's a dependency cycle between SAMLDiscovery.setSamlEntryPoint and SAMLEntryPoint.setSamlDiscovery. This generates an error on startup as of Spring Boot 2.6.

The dependencies of some of the beans in the application context form a cycle:

   samlFilter
┌─────┐
|  samlEntryPoint
↑     ↓
|  samlDiscovery
└─────┘

Workaround is to set spring.main.allow-circular-references=true.

wilkinsona commented 2 years ago

This could also affect users of earlier Spring Boot versions or of plain Spring Framework if they've set AbstractAutowireCapableBeanFactory.setAllowCircularReferences(boolean) to false as Boot does by default as of 2.6.

gertjanal commented 2 years ago

Workaround for Spring Boot:

final SpringApplicationBuilder builder = new SpringApplicationBuilder(applicationClass)
    .allowCircularReferences(true)
    ...