apache / shiro

Apache Shiro
https://shiro.apache.org/
Apache License 2.0
4.33k stars 2.31k forks source link

[Bug] Spring-boot-3-web won't start with spring Actuator active #1691

Open tvartom opened 3 months ago

tvartom commented 3 months ago

Search before asking

Environment

Tested with Java 17, Ubuntu, started with mvn spring-boot:run

Shiro version

2.0.1

What was the actual outcome?

Application will not start, due to org.apache.shiro.spring.web.config.ShiroRequestMappingConfig finding two RequestMappingHandlerMapping-beans.

Output:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in org.apache.shiro.spring.web.config.ShiroRequestMappingConfig required a single bean, but 2 were found:
        - requestMappingHandlerMapping: defined by method 'requestMappingHandlerMapping' in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
        - controllerEndpointHandlerMapping: defined by method 'controllerEndpointHandlerMapping' in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]

This may be due to missing parameter name information

What was the expected outcome?

Spring acuator should be possible to use with Shiro.

How to reproduce

Add this dependency:

<dependency>
    <!-- Add endpoints that let you monitor and manage your application - such as application health, metrics, sessions, etc. -->
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

to the spring-boot-3-web-sample (https://github.com/apache/shiro/blob/main/samples/spring-boot-3-web/pom.xml) Run with mvn spring-boot:run Startup will fail.

Debug logs

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< org.apache.shiro.samples:samples-spring-boot-3-web >---------
[INFO] Building Apache Shiro :: Samples :: Spring Boot 3 Web 2.0.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:3.3.1:run (default-cli) > test-compile @ samples-spring-boot-3-web >>>
[INFO] 
[INFO] --- apache-rat-plugin:0.16.1:check (rat-check) @ samples-spring-boot-3-web ---
[INFO] Rat check: Summary over all files. Unapproved: 0, unknown: 0, generated: 0, approved: 12 licenses.
[INFO] 
[INFO] --- directory-maven-plugin:1.0:directory-of (directories) @ samples-spring-boot-3-web ---
[INFO] Directory of org.apache.shiro:shiro-root set to: /home/workspace/lab/shiro
[INFO] 
[INFO] --- maven-checkstyle-plugin:3.5.0:checkstyle (default) @ samples-spring-boot-3-web ---
[WARNING] Site model of 'org.apache.shiro:shiro-root:pom:2.0.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[INFO] Rendering content with org.apache.maven.skins:maven-fluido-skin:jar:1.5 skin
[INFO] Starting audit...
Audit done.
[INFO] 
[INFO] --- buildnumber-maven-plugin:3.2.0:create (default) @ samples-spring-boot-3-web ---
[INFO] 
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-maven-version) @ samples-spring-boot-3-web ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] 
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-java-version) @ samples-spring-boot-3-web ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] 
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-maven) @ samples-spring-boot-3-web ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] 
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-forbidden-dependencies) @ samples-spring-boot-3-web ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.BannedDependencies passed
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.12:prepare-agent (prepare-agent) @ samples-spring-boot-3-web ---
[INFO] Skipping JaCoCo execution because property jacoco.skip is set.
[INFO] 
[INFO] --- gmavenplus-plugin:3.0.2:addTestSources (default) @ samples-spring-boot-3-web ---
[INFO] 
[INFO] --- maven-remote-resources-plugin:3.2.0:process (process-resource-bundles) @ samples-spring-boot-3-web ---
[INFO] Preparing remote bundle org.apache.apache.resources:apache-jar-resource-bundle:1.5
[INFO] Copying 3 resources from 1 bundle.
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ samples-spring-boot-3-web ---
[INFO] Copying 6 resources from src/main/resources to target/classes
[INFO] Copying 3 resources from target/maven-shared-archive-resources to target/classes
[INFO] 
[INFO] --- maven-compiler-plugin:3.13.0:compile (default-compile) @ samples-spring-boot-3-web ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- gmavenplus-plugin:3.0.2:generateTestStubs (default) @ samples-spring-boot-3-web ---
[INFO] No sources specified for stub generation. Skipping.
[INFO] Generated 0 stubs.
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:testResources (default-testResources) @ samples-spring-boot-3-web ---
[INFO] skip non existing resourceDirectory /home/workspace/lab/shiro/samples/spring-boot-3-web/src/test/resources
[INFO] Copying 3 resources from target/maven-shared-archive-resources to target/test-classes
[INFO] 
[INFO] --- maven-compiler-plugin:3.13.0:testCompile (default-testCompile) @ samples-spring-boot-3-web ---
[INFO] No sources to compile
[INFO] 
[INFO] --- gmavenplus-plugin:3.0.2:compileTests (default) @ samples-spring-boot-3-web ---
[INFO] No sources specified for compilation. Skipping.
[INFO] 
[INFO] --- gmavenplus-plugin:3.0.2:removeTestStubs (default) @ samples-spring-boot-3-web ---
[INFO] 
[INFO] <<< spring-boot-maven-plugin:3.3.1:run (default-cli) < test-compile @ samples-spring-boot-3-web <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:3.3.1:run (default-cli) @ samples-spring-boot-3-web ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.1)

2024-08-24T05:07:47.374+02:00  INFO 1277568 --- [           main] org.apache.shiro.samples.WebApp          : Starting WebApp using Java 17.0.12 with PID 1277568 (/home/workspace/lab/shiro/samples/spring-boot-3-web/target/classes started by **** in /home/workspace/lab/shiro/samples/spring-boot-3-web)
2024-08-24T05:07:47.376+02:00  INFO 1277568 --- [           main] org.apache.shiro.samples.WebApp          : No active profile set, falling back to 1 default profile: "default"
2024-08-24T05:07:47.754+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration' of type [org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [lifecycleBeanPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.
2024-08-24T05:07:47.757+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration' of type [org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [defaultAdvisorAutoProxyCreator] is declared through a non-static factory method on that class; consider declaring it as static instead.
2024-08-24T05:07:47.763+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'eventBus' of type [org.apache.shiro.event.support.DefaultEventBus] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.786+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration' of type [org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.787+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'webApp' of type [org.apache.shiro.samples.WebApp$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.794+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'realm' of type [org.apache.shiro.realm.text.TextConfigurationRealm] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.808+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionStorageEvaluator' of type [org.apache.shiro.web.mgt.DefaultWebSessionStorageEvaluator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.808+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'subjectDAO' of type [org.apache.shiro.mgt.DefaultSubjectDAO] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.808+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'subjectFactory' of type [org.apache.shiro.web.mgt.DefaultWebSubjectFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.809+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'rememberMeCookieTemplate' of type [org.apache.shiro.web.servlet.SimpleCookie] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.810+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'rememberMeManager' of type [org.apache.shiro.web.mgt.CookieRememberMeManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.810+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'authenticationStrategy' of type [org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.810+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'authenticator' of type [org.apache.shiro.authc.pam.ModularRealmAuthenticator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.810+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'authorizer' of type [org.apache.shiro.authz.ModularRealmAuthorizer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.811+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionCookieTemplate' of type [org.apache.shiro.web.servlet.SimpleCookie] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.811+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionFactory' of type [org.apache.shiro.session.mgt.SimpleSessionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.812+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionDAO' of type [org.apache.shiro.session.mgt.eis.MemorySessionDAO] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.812+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sessionManager' of type [org.apache.shiro.web.session.mgt.DefaultWebSessionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.813+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'securityManager' of type [org.apache.shiro.web.mgt.DefaultWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.815+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'authorizationAttributeSourceAdvisor' of type [org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [shiroEventBusAwareBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.818+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'shiroFilterChainDefinition' of type [org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.823+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'requestContextFilter' of type [org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.826+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration' of type [org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.828+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'formContentFilter' of type [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.844+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'server-org.springframework.boot.autoconfigure.web.ServerProperties' of type [org.springframework.boot.autoconfigure.web.ServerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.845+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration' of type [org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.846+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'characterEncodingFilter' of type [org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.849+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration' of type [org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.853+02:00  WARN 1277568 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'globalFilters' of type [java.util.Collections$SingletonList] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor []? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-08-24T05:07:47.970+02:00  INFO 1277568 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-08-24T05:07:47.975+02:00  INFO 1277568 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-08-24T05:07:47.976+02:00  INFO 1277568 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.25]
2024-08-24T05:07:48.004+02:00  INFO 1277568 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-08-24T05:07:48.004+02:00  INFO 1277568 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 601 ms
2024-08-24T05:07:48.249+02:00  WARN 1277568 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.shiro.spring.web.config.ShiroRequestMappingConfig': Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' available: expected single matching bean but found 2: requestMappingHandlerMapping,controllerEndpointHandlerMapping
2024-08-24T05:07:48.251+02:00  INFO 1277568 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-08-24T05:07:48.260+02:00  INFO 1277568 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-08-24T05:07:48.267+02:00 ERROR 1277568 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in org.apache.shiro.spring.web.config.ShiroRequestMappingConfig required a single bean, but 2 were found:
        - requestMappingHandlerMapping: defined by method 'requestMappingHandlerMapping' in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
        - controllerEndpointHandlerMapping: defined by method 'controllerEndpointHandlerMapping' in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]

This may be due to missing parameter name information

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

Ensure that your compiler is configured to use the '-parameters' flag.
You may need to update both your build tool settings as well as your IDE.
(See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.169 s
[INFO] Finished at: 2024-08-24T05:07:48+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.1:run (default-cli) on project samples-spring-boot-3-web: Process terminated with exit code: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
tvartom commented 3 months ago

Here is an similar issue and some more information: https://github.com/spring-projects/spring-boot/issues/31961

lprimak commented 3 months ago

I've looked at your link attached, but I am not a Spring user, so PR would be appreciated

tvartom commented 3 months ago

The solution might be to just update org.apache.shiro.spring.web.config.ShiroRequestMappingConfig to take a list::

package org.apache.shiro.spring.web.config;

import java.util.List;

import org.apache.shiro.spring.web.ShiroUrlPathHelper;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

@Configuration
public class ShiroRequestMappingConfig {
    public ShiroRequestMappingConfig(List<RequestMappingHandlerMapping> requestMappingHandlerMappings) {
        for (RequestMappingHandlerMapping requestMappingHandlerMapping : requestMappingHandlerMappings) {
            requestMappingHandlerMapping.setUrlPathHelper(new ShiroUrlPathHelper());
        }
    }
}

But I'm not aware of the implications of this change. I'm also not familiar to the Shiro ecosystem. I tried to update, but I got problems when trying to run it, due to some comparison of the API.

[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.23.0:cmp (japicmp) on project shiro-spring: There is at least one incompatibility: org.apache.shiro.spring.web.config.ShiroRequestMappingConfig.ShiroRequestMappingConfig(org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping):CONSTRUCTOR_REMOVED -> [Help 1]
tvartom commented 3 months ago

And should it be one new ShiroUrlPathHelper() for each bean? Or just create one and share?

lprimak commented 3 months ago

Please submit a PR. I will help you get it to compile and "over the fence"

travelwink commented 1 month ago

I also encountered the same error when building a Spring Boot 3.3.4 project and adding the dependencies shiro 2.0.1 and actuator 3.3.4.