首页 新闻 搜索 专区 学院

java》freemarker配置问题

0
悬赏园豆:20 [已解决问题] 解决于 2020-06-16 11:13

背景:就是需要用到子母页的结构但是我原本是写.net的,这个不大会,然后现在是报了个错:
Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Map' for property 'settings'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Map' for property 'settings': no matching editors or conversion strategy found

就想请问下是什么原因

源码:
pom.xml:
<dependency>
<groupId>com.googlecode.rapid-framework</groupId>
<artifactId>rapid-core</artifactId>
<version>4.0.5</version>
</dependency>
<!-- lang包 缺少的话可能会报错 -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>

配置类:
import cn.org.rapid_framework.freemarker.directive.BlockDirective;
import cn.org.rapid_framework.freemarker.directive.ExtendsDirective;
import cn.org.rapid_framework.freemarker.directive.OverrideDirective;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FrameworkConfig {
@Autowired
freemarker.template.Configuration configuration;
@PostConstruct
public void setSharedVariable(){
configuration.setSharedVariable("block", new BlockDirective());
configuration.setSharedVariable("override", new OverrideDirective());
configuration.setSharedVariable("extends", new ExtendsDirective());
}
}

appliction.properties:
spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.charset=utf-8
spring.freemarker.cache=false
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.expose-spring-macro-helpers=true
spring.freemarker.suffix=.ftl

ZHOULEI8076的主页 ZHOULEI8076 | 初学一级 | 园豆:192
提问于:2020-06-12 13:43
< >
分享
最佳答案
0

和你配置没关系吧,页面上要一个Map,你给传了个字符串进去?

收获园豆:20
yytxdy | 小虾三级 |园豆:1067 | 2020-06-12 17:48

但是这个我把这些配置去掉就没这个报错了,不过我用另外一种方式去实现子母页了,还是多谢了

ZHOULEI8076 | 园豆:192 (初学一级) | 2020-06-16 11:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册