Maven导入shiro的依赖后,欢迎页面404、shiro-features异常的解决方案:

自己练习shiro的时候,导入shiro官网的全部依赖,发现有两个依赖在项目里会造成某些异常。

以下时shiro官方提供的全部依赖,但是有两个最好注释掉:

<!-- shiro相关的所有依赖等同于shiro-all -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-core</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-web</artifactId>
            <version>1.5.2</version>
        </dependency>
        <!-- <dependency> 
            <groupId>org.apache.shiro</groupId> 
            <artifactId>shiro-servlet-plugin</artifactId> 
            <version>1.5.2</version> 
        </dependency> -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-jaxrs</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-aspectj</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-cas</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-ehcache</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-hazelcast</artifactId>
            <version>1.5.2</version>
        </dependency>
        <!--<dependency> 
        <groupId>org.apache.shiro</groupId> 
            <artifactId>shiro-features</artifactId> 
            <version>1.5.2</version> 
        </dependency> -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-guice</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-quartz</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring</artifactId>
            <version>1.5.2</version>
        </dependency>
        <!--<dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring-boot-starter</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring-boot-web-starter</artifactId>
            <version>1.5.2</version>
        </dependency> -->

springboot的依赖就不说了,这里用maven项目。

其中造成异常的两个pom依赖:

shiro-servlet-plugin依赖会造成欢迎页面404,shiro-features依赖由于无法下载,索性注释掉。

相关推荐