zoukankan      html  css  js  c++  java
  • springboot2.0集成shiro出现ShiroDialect报错找不到AbstractTextChildModifierAttrPr

       @Bean
        public ShiroDialect shiroDialect() {
            return new ShiroDialect();
        }

    报错出现找不到org/thymeleaf/processor/attr/AbstractTextChildModifierAttrProcessor

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroDialect' defined in class path resource [com/zhicaili/springbootshiro/config/ShiroConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [at.pollux.thymeleaf.shiro.dialect.ShiroDialect]: Factory method 'shiroDialect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/thymeleaf/processor/attr/AbstractTextChildModifierAttrProcessor
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
        at com.zhicaili.springbootshiro.SpringbootShiro01Application.main(SpringbootShiro01Application.java:15) [classes/:na]
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [at.pollux.thymeleaf.shiro.dialect.ShiroDialect]: Factory method 'shiroDialect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/thymeleaf/processor/attr/AbstractTextChildModifierAttrProcessor
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
        ... 18 common frames omitted

    再来查看下thymeleaf-extras-shiro 的版本,真的是版本的问题

    一开始的版本

            <dependency>
                <groupId>com.github.theborakompanioni</groupId>
                <artifactId>thymeleaf-extras-shiro</artifactId>
                <version>1.2.1</version>
            </dependency>

    修改成2.0.0就没问题了

    修改后

            <dependency>
                <groupId>com.github.theborakompanioni</groupId>
                <artifactId>thymeleaf-extras-shiro</artifactId>
                <version>2.0.0</version>
            </dependency>
  • 相关阅读:
    ABA问题怎么解:AtomicStampedReference和AtomicMarkableReference
    原子类型累加器
    Spring Boot使用嵌入式容器,那怎么配置自定义Filter呢
    痞子衡嵌入式:语音处理工具pzh-speech诞生记
    痞子衡嵌入式:串口调试工具pzh-com诞生记(6)- 打包发布(PyInstaller3.3.1)
    痞子衡嵌入式:串口调试工具pzh-com诞生记(5)- 软件优化
    痞子衡嵌入式:串口调试工具pzh-com诞生记(4)- 联合调试(vspd, sscom, PyCharm2018.2)
    痞子衡嵌入式:串口调试工具pzh-com诞生记(3)- 串口功能实现(pySerial)
    痞子衡嵌入式:串口调试工具pzh-com诞生记(2)- 界面构建(wxFormBuilder3.8.0)
    痞子衡嵌入式:极易上手的可视化wxPython GUI构建工具(wxFormBuilder)
  • 原文地址:https://www.cnblogs.com/limn/p/9690265.html
Copyright © 2011-2022 走看看