From b6a5af44beff951cb677af3a9f4a057a8d1ba0b6 Mon Sep 17 00:00:00 2001 From: Brian Koehmstedt <1261658+bkoehm@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:40:34 -0800 Subject: [PATCH] fix detection of FilterChainProxy bean presence such that a NoSuchBeanDefinitionException isn't thrown if the class resolves but the bean doesn't exist --- .../groovy/org/grails/plugins/web/taglib/FormTagLib.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy index 32840db31a..80a66ee6d2 100644 --- a/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy +++ b/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy @@ -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) }) {