Spring Boot Thymeleaf Вызов метода безопасности Spring не найден для типа org.springframework.security.web.access.expression.WebSecurityExpressionRoot - PullRequest
0 голосов
/ 28 марта 2020

Итак, я использую Spring Boot 2.2.5.RELEASE, простое веб-приложение с Thymeleaf

            <div class="pull-right" sec:authorize="hasAuthority('IDENTITY_PERSON','IDENTITY_ORGANISATION','IDENTITY_ORGANISATION_ADMIN')">
              <a th:href="@{/company/create}" href="#" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;Create Company</a>
            </div>

вышеприведенный код неожиданно вызывает исключение, я что-то неправильно настроил? В предыдущих версиях это работало хорошо!

org.springframework.expression.spel.SpelEvaluationException: EL1004E: вызов метода: метод hasAuthority (java .lang.String, java .lang.String, java .lang.String) не может быть найден для типа org.springframework.security.web.access.expression.WebSecurityExpressionRoot в org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod (MethodReference. java: 22) spring-expression-5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.expression.spel.ast.MethodReference.getValueInternal (MethodReference. java: 135) ~ [spring-expression-5.2.4 .RELEASE.jar: 5.2.4.RELEASE] at org.springframework.expression.spel.ast.MethodReference.getValueInternal (MethodReference. java: 95) ~ [spring-expression-5.2.4.RELEASE.jar: 5.2. 4.RELEASE] в org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue (SpelNodeImpl. java: 117) ~ [spring-expression-5.2.4.RELEASE.jar: 5.2.4.RELEASE] в орг. springframework.expression.spel.standard.SpelExpres sion.getValue (SpelExpression. java: 308) ~ [spring-expression-5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean (ExpressionUtils. java: 26) ~ [spring-security-core-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.thymeleaf.extras.springsecurity5.auth.AuthUtils $ MvcAuthUtils.authorizeUsingAccessExpression Mvc (AuthUtils. java: 353) ~ [thymeleaf-extras-springsecurity5-3.0.4.RELEASE.jar: 3.0.4.RELEASE] в org.thymeleaf.extras.springsecurity5.auth.AuthUtils $ MvcAuthUtils.access $ 100 (AuthUtils. java) : 304) ~ [thymeleaf-extras-springsecurity5-3.0.4.RELEASE.jar: 3.0.4.RELEASE] в org.thymeleaf.extras.springsecurity5.auth.AuthUtils.authorizeUsingAccessExpression (AuthUtils. java: 173) ~ [ thymeleaf-extras-springsecurity5-3.0.4.RELEASE.jar: 3.0.4.RELEASE] at org.thymeleaf.extras.springsecurity5.dialect.processor.AuthorizeAttrProcessor.isVisible (AuthorizeAttrProcessor. java: 73) ~ [extramele] -springsecurity5-3.0.4.RELEASE.jar: 3.0.4.RELEASE] в организации .thymeleaf.standard.processor.AbstractStandardConditionalVisibilityTagProcessor.doProcess (AbstractStandardConditionalVisibilityTagProcessor. java: 61) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thY AbstractAttributeTagProcessor. java: 74) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.processor.element.AbstractElementTagProcessor.process (AbstractElementTagProcessor. java: 95) [1024 *: 95) [ -3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.util.ProcessorConfigurationUtils $ ElementTagProcessorWrapper.process (ProcessorConfigurationUtils. java: 633) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0. 11.RELEASE] в org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement (ProcessorTemplateHandler. java: 1314) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.enment.OpenE. beHandled (OpenElementTag. java: 205) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.Model.proce ss (Модель. java: 282) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement (ProcessorTemplateHandler. java: 1587) ~ [thymeleaf -3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.OpenElementTag.beHandled (OpenElementTag. java: 205) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11. RELEASE] в org.thymeleaf.engine.Model.process (Model. java: 282) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement ( ProcessorTemplateHandler. java: 1587) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.OpenElementTag.beHandled (OpenElementTag. java: 205) ~ [thymeleaf-3.0 .11.RELEASE. jar: 3.0.11.RELEASE] в org.thymeleaf.engine.Model.process (Model. java: 282) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf. engine.Model.process (Model. java: 290) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.GatheringModelProcessable.process (GatheringModelProcessable. java: 78 ) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement (ProcessorTemplateHandler. java: 1640) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleCloseElementEnd (TemplateHandlerAdapterMarkupHandler. java: 388) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEplate или at]. markup.InlinedOutputExpressionMarkupHandler $ InlineMarkupAdapterPreProcessorHandler.handleCloseElementEnd (InlinedOutputExpressionMarkupHandler. java: 322) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEutPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlayPlay. ndler.handleCloseElementEnd (OutputExpressionInlinePreProcessorHandler. java: 220) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf. ) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.attoparser.HtmlElement.handleCloseElementEnd (HtmlElement. java: 169) ~ [attoparser-2.0.5.RELEASE.jar: 2.0. 5.RELEASE] в org.attoparser. java: 473) ~ [attoparser-2.0.5.RELEASE.jar: 2.0.5.RELEASE] в org.attoparser.ParsingElementMarkupUtil.parseCloseElement (ParsingElementMarkupUtil. java: 201) ~ [attoparser-2.0.5.RELE .jar: 2.0.5.RELEASE] в org.attoparser.MarkupParser.parseBuffer (MarkupParser. java: 725) ~ [attoparser-2.0.5.RELEASE.jar: 2.0.5.RELEASE] в org.at toparser.MarkupParser.parseDocument (MarkupParser. java: 301) ~ [attoparser-2.0.5.RELEASE.jar: 2.0.5.RELEASE] в org.attoparser.MarkupParser.parse (MarkupParser. java: 257) ~ [attoparser-2.0.5.RELEASE.jar: 2.0.5.RELEASE] в org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse (AbstractMarkupTemplateParser. java: 230) ~ [thymeleaf-3.0.11.RELEASE.jar 3.0.11.RELEASE] at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone (AbstractMarkupTemplateParser. java: 100) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEyg. engine.TemplateManager.parseAndProcess (TemplateManager. java: 666) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.TemplateEngine.process (TemplateEngine. java: 1098) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11.RELEASE] в org.thymeleaf.TemplateEngine.process (TemplateEngine. java: 1072) ~ [thymeleaf-3.0.11.RELEASE.jar: 3.0.11. RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.renderFragment (ThymeleafView. java: 362) ~ [thy meleaf-spring5-3.0.11.RELEASE.jar: 3.0.11.RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.render (ThymeleafView. java: 189) ~ [thymeleaf-spring5-3.0.11.RELEASE .jar: 3.0.11.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render (DispatcherServlet. java: 1373) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4 .RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult (DispatcherServlet. java: 1118) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4.RELEASE] в орг. springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet. java: 1057) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.web.servlet. DispatcherServlet.doService (DispatcherServlet. java: 943) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet. java: 1006) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet. java: 898) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2.4.RELEASE] в javax.servlet.http.HttpServlet.service (HttpServlet. java: 634) ~ [tomcat-embed-core- 9.0.31.jar: 9.0.31] at org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet. java: 883) ~ [spring-web mvc -5.2.4.RELEASE.jar: 5.2. 4.RELEASE] на javax.servlet.http.HttpServlet.service (HttpServlet. java: 741) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] на орг. apache .catalina. core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 231) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain *. 1075 *: 166) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .tomcat.websocket.server.WsFilter.doFilter (WsFilter. java: 53) ~ [ tomcat-embed-websocket-9.0.31.jar: 9.0.31] at org. apache .catalina.core.ApplicationFilterChai n.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в организации. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java) : 166) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 320) ~ [spring-security- web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor. java: 126) ~ [spring-security-web-5.2 .2.RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor. java: 90) ~ [spring-security-web-5.2.2. RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2 .2.RELEASE] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter (Excep ionTranslationFilter. java: 118) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java) : 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] по адресу org.springframework.security.web.session.SessionManagementFilter.doFilter (SessionManagementFilter. java: 137) ~ [ spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web -5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter (AnonymousAuthenticationFilter. java: 111) ~ [spring-security-web-5.2.2. RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2 .2.RELEASE] at org.springframework.security.web.servletapi.SecurityContex tHolderAwareRequestFilter.doFilter (SecurityContextHolderAwareRequestFilter. java: 158) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2. . java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter (RequestCacheAwareFilter. java: 63) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring -security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter (AbstractAuthenticationProcessingFilter. java: 200) ~ [spring-security-web- 5.2.2.RELEASE.jar: 5.2.2.RELEASE] на org.springframework.security.web. FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.authentication.logout.LogoutFilter .doFilter (LogoutFilter. java: 116) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] по адресу org.springframework.security.web.csrf.CsrfFilter.doFilterInternal (CsrfFilter. java: 117 ) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) ~ [spring-web- 5.2.4.RELEASE.jar: 5.2.4.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE .jar: 5.2.2.RELEASE] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter (HeaderWriterFi lter. java: 92) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal (HeaderWriterFilter. java : 77) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] по адресу org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) ~ [spring- web-5.2.4.RELEASE.jar: 5.2.4.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2 .RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter (SecurityContextPersistenceFilter. java: 105) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE ] at org.springframework.security.web.context.request.asyn c .WebAsyncManagerIntegrationFilter.doFilterIn ternal (WebAsyncManagerIntegrationFilter. java: 56) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. * 11 *) : 119) ~ [spring-web-5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 334) ~ [spring- security-web-5.2.2.RELEASE.jar: 5.2.2.RELEASE] в org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy. java: 215) ~ [spring-security-web-5.2.2 .RELEASE.jar: 5.2.2.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy. java: 178) ~ [spring-security-web-5.2.2.RELEASE.jar: 5.2. 2.RELEASE] на org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy. java: 358) ~ [spring-web-5.2.4.RELEASE.jar: 5.2.4.RELEASE] на org.springframework. web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy. java: 271) ~ [spring-web-5.2.4.RELEASE.jar: 5.2.4 .RELEASE] at org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в org.springframework.session.web.http.SessionRepositoryFilter.doFilterIn SessionRepositoryFilter. java: 141) ~ [spring-session-core-2.2.2.RELEASE.jar: 2.2.2.RELEASE] в org.springframework.session.web.http.OncePerRequestFilter.doFilter (OncePerRequestFilter. java : 82) ~ [spring-session-core-2.2.2.RELEASE.jar: 2.2.2.RELEASE] at org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [ tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core-9.0.31 .jar: 9.0.31] в орг. springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter. java: 201) ~ [spring-web-5.2.4.RELEASE.jar: 5.2.4.RELEASE] в org.springframework.web.filter.OncePerReFF (OncePerRequestFilter. java: 119) ~ [spring-web-5.2.4.RELEASE.jar: 5.2.4.RELEASE] at org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) ~ [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) ~ [tomcat-embed-core -9.0.31.jar: 9.0.31] в орг. apache .catalina.core.StandardWrapperValve.invoke (StandardWrapperValve. java: 202) ~ [tomcat-embed-core-9.0.31.jar: 9.0. 31] at org. apache .catalina.core.StandardContextValve.invoke (StandardContextValve. java: 96) [tomcat-embed-core-9.0.31.jar: 9.0.31] в org. apache .catalina .authenticator.AuthenticatorBase.invoke (AuthenticatorBase. java: 541) [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .catalina.core.StandardHostValve.i nvoke (StandardHostValve. java: 139) [tomcat-embed-core-9.0.31.jar: 9.0.31] в организации. apache .catalina.valves.ErrorReportValve.invoke (ErrorReportValve. java: 92) [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .catalina.core.StandardEngineValve.invoke (StandardEngineValve. java: 74) [tomcat-embed-core-9.0.31 .jar: 9.0.31] в орг. apache .catalina.connector.CoyoteAdapter.service (CoyoteAdapter. java: 343) [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .coyote.http11.Http11Processor.service (Http11Processor. java: 367) [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .coyote.AbstractProcessorLight.process ( AbstractProcessorLight. java: 65) [tomcat-embed-core-9.0.31.jar: 9.0.31] в орг. apache .coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol. java: 868) [tomcat -embed-core-9.0.31.jar: 9.0.31] в орг. apache .tomcat.util. net .NioEndpoint $ SocketProcessor.doRun (NioEndpoint. java: 1639) [tomcat-embed-core -9.0.31.jar: 9.0.31] в орг. apache .tomcat.util. net .SocketProcessorBase.run (Soc ketProcessorBase. java: 49) [tomcat-embed-core-9.0.31.jar: 9.0.31] в java .util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor. java: 1149) [нет: 1,8 .0_211] в java .util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor. java: 624) [na: 1.8.0_211] в орг. apache .tomcat.util.threads.TaskThread $ WrappingRunnable. выполнить (TaskThread. java: 61) [tomcat-embed-core-9.0.31.jar: 9.0.31] в java .lang.Thread.run (поток. java: 748) [na: 1,8 .0_211]


1 Ответ

0 голосов
/ 28 марта 2020

Что ж, получается все просто: мне нужно использовать se c: authorize = "hasAnyAuthority" с несколькими аргументами, поскольку hasAuthority принимает только один аргумент.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...