使用Yaml配置Thymeleaf spring security 4集成模块

时间:2016-10-14 09:09:35

标签: spring-security spring-boot thymeleaf

我正在尝试使用spring security 4集成模块(https://github.com/thymeleaf/thymeleaf-extras-springsecurity),好像我必须使用java配置,这在Yaml中无法完成。

我没有使用任何spring xml配置。只有Yaml和java配置。

有没有配置弹簧安全集成模块但是没有搞乱Spring启动提供的百万美元自动配置?

现在我正在进行如下配置:

@Bean
public ViewResolver viewResolver() {
    ThymeleafViewResolver resolver = new ThymeleafViewResolver();
    resolver.setTemplateEngine(templateEngine());
    resolver.setCharacterEncoding("UTF-8");
    return resolver;
}

@Bean
public SpringTemplateEngine templateEngine() {
    SpringTemplateEngine engine = new SpringTemplateEngine();
    dialects.add(new org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect());
    engine.setAdditionalDialects(dialects);
    engine.setTemplateResolver(templateResolver());
    return engine;
}

private ITemplateResolver templateResolver() {
    SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
    resolver.setApplicationContext(applicationContext);
    resolver.setPrefix("classpath:/templates/");
    resolver.setTemplateMode("HTML5");
    return resolver;
}

但我得到java.lang.NoClassDefFoundError: org/thymeleaf/dialect/IProcessorDialect 提前谢谢你,

0 个答案:

没有答案