Open tvartom opened 3 months ago
Here is an similar issue and some more information: https://github.com/spring-projects/spring-boot/issues/31961
I've looked at your link attached, but I am not a Spring user, so PR would be appreciated
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]
And should it be one new ShiroUrlPathHelper()
for each bean? Or just create one and share?
Please submit a PR. I will help you get it to compile and "over the fence"
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.
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:
What was the expected outcome?
Spring acuator should be possible to use with Shiro.
How to reproduce
Add this dependency:
to the
spring-boot-3-web-sample
(https://github.com/apache/shiro/blob/main/samples/spring-boot-3-web/pom.xml) Run withmvn spring-boot:run
Startup will fail.Debug logs