Rythm git_repo Rythm源码库提供的版本有点老了。
自己更新下 (https://github.com/icngor/spring-rythm)
- spring: 4.3.10.RELEASE
- rythmengine: 1.2.0
git clone git@github.com:icngor/spring-rythm.git
mvn install
在 pom.xml中添加依赖:
<dependency>
<groupId>org.rythmengine</groupId>
<artifactId>spring-rythm</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
新建一个配置类:
@Bean
public RythmConfigurer configurer() {
RythmConfigurer configurer = new RythmConfigurer();
configurer.setResourceLoaderPath("/templates"); //模板目录
configurer.setDevMode(true);
return configurer;
}
@Bean
public ViewResolver resolver() {
RythmViewResolver resolver = new RythmViewResolver();
resolver.setPrefix("/templates/"); // 模板前缀
resolver.setSuffix(".html"); // 后缀
resolver.setOrder(0); // 设置优先使用rythm模板引擎解析
return resolver;
}
在官网找到一个idea插件:https://github.com/scireum-incubator/rythm_plugin