定制的百里香方言注册导致异常

时间:2013-12-19 10:49:35

标签: spring spring-mvc thymeleaf

在applicationContext.xml中

 <bean id="templateEngine"
      class="org.thymeleaf.spring3.SpringTemplateEngine">
    <property name="templateResolver" ref="templateResolver" />
    <property name="additionalDialects">
        <set>
            <bean class="org.test.custom.CustomDialact" />
        </set>
    </property>
</bean>

堆栈跟踪:

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'additionalDialects' of bean class [org.thymeleaf.spring3.SpringTemplateEngine]: Bean property 'additionalDialects' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1424)
... 50 more

1 个答案:

答案 0 :(得分:0)

我不知道但重新启动机器后它已修复。但是我找到了另一个解决方案 通过使用HashSet扩展自定义类并在构造函数中添加自定义方言并在xml中声明它。提供additionalDialects的参考。多数民众赞成。它将开始运行。它认为这是与仿制品有关的问题,因为春天有时供应空类型 比如HashSet<V>

相关问题