You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "jiahua_lan (Jira)" <ji...@apache.org> on 2019/12/09 04:45:00 UTC

[jira] [Comment Edited] (SHIRO-732) Configuration conflict

    [ https://issues.apache.org/jira/browse/SHIRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16991131#comment-16991131 ] 

jiahua_lan edited comment on SHIRO-732 at 12/9/19 4:44 AM:
-----------------------------------------------------------

I use Spring Initializr to create the project. The build tool of choice is Gradle, and the Gradle version is 6.0. SpringBoot version is 2.1.8RELEASE. The content of the build.gradle file is as follows:


plugins {
    id 'org.springframework.boot' version '2.1.8.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.miaostar'
version = '0.0.1-SNAPSHOT'

sourceCompatibility = '1.8'

repositories {
    mavenCentral ()
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
    compileOnly {
        extendsFrom annotationProcessor
    }
}

dependencies {
    implementation 'org.springframework.boot: spring-boot-starter-web'
    implementation 'org.springframework.boot: spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot: spring-boot-starter-actuator'
    testImplementation 'org.springframework.boot: spring-boot-starter-test'

    implementation 'org.apache.shiro: shiro-spring-boot-web-starter: +'
    implementation 'io.jsonwebtoken: jjwt-jackson: 0.10.7'

    compileOnly 'org.projectlombok: lombok'
    developmentOnly 'org.springframework.boot: spring-boot-devtools'
    runtimeOnly 'com.h2database: h2'
    annotationProcessor 'org.projectlombok: lombok'
}

test {
    useJUnitPlatform ()
}


was (Author: miao_oaim):
I use Spring Initializr to create the project, and the build tool of choice is Gradle. Spring Boot version is 2.1.8RELEASE, dependencies include org.apache.shiro: shiro-spring-boot-web-starter: 1.4.2
org.springframework.boot: spring-boot-starter-web
org.springframework.boot: spring-boot-starter-data-jpa
org.springframework.boot: spring-boot-starter-actuator
com.h2database: h2
org.projectlombok: lombok
io.jsonwebtoken: jjwt-jackson: 0.10.7

> Configuration conflict
> ----------------------
>
>                 Key: SHIRO-732
>                 URL: https://issues.apache.org/jira/browse/SHIRO-732
>             Project: Shiro
>          Issue Type: Question
>          Components: Configuration
>    Affects Versions: 1.4.2
>            Reporter: jiahua_lan
>            Priority: Major
>
> When I used shiro-spring-boot-web-starter, I found that the configuration of both *org.apache.shiro.spring.web.config.ShiroWebConfiguration* and *org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration* seems to be Conflict with each other. One bean is defined in *org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration*, the bean id is shiroFilterChainDefinition, and it will be declared when there are no beans of the same type in the IOC container. And *org.apache.shiro.spring.web.config.ShiroWebConfiguration* also has a bean declaration with a bean id of shiroFilterChainDefinition, without any conditions, and both classes have @Configuration annotations, which means that when the classpath is at the same time When there are two classes, the configuration of shiroFilterChainDefinition in org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration does not take effect. I also cannot replace the default configuration by configuring shiroFilterChainDefinition myself. If I configure shiroFilterChainDefinition in my project it will appear *[The bean 'shiroFilterChainDefinition', defined in class path resource [xxxx], could not be registered. A bean with that name has already been defined in class path resource [org / apache / shiro / spring / web / config / ShiroWebConfiguration.class] and overriding is disabled.]* and the project fails to start. Can this be counted as a bug? Or is there any other solution?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)