Skip to content

Commit

Permalink
fix detection of FilterChainProxy bean presence such that a NoSuchBea…
Browse files Browse the repository at this point in the history
…nDefinitionException isn't thrown if the class resolves but the bean doesn't exist
  • Loading branch information
bkoehm committed Nov 20, 2024
1 parent ee0ab1c commit b6a5af4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrar
conversionService = applicationContext.getBean('mvcConversionService', ConversionService)
}
try {
var filterChainProxy = applicationContext.getBean(
Class.forName("org.springframework.security.web.FilterChainProxy"))
var filterChainProxy = applicationContext.getBeanProvider(
Class.forName("org.springframework.security.web.FilterChainProxy")).ifAvailable
var csrfFilterClass =
Class.forName("org.springframework.security.web.csrf.CsrfFilter")
if (filterChainProxy?.filterChains*.filters?.flatten()?.any { csrfFilterClass.isInstance(it) }) {
Expand Down

0 comments on commit b6a5af4

Please sign in to comment.