如何为Apache Velocity禁用Spring Boot的自动配置?

Don*_*tTo 9 velocity spring-boot

我正在尝试使用Spring Boot(1.1.9.RELEASE)和Apache Velocity(1.7),目的是使用Velocity作为生成电子邮件的模板工具.我正在使用Thymeleaf(2.1.3.RELEASE)进行网页模板.

Spring Boot的自动配置在启动期间检测类路径上的Velocity,并将其添加为Web视图解析器.虽然这很精彩,但这不是我想要的,所以我试过了

@EnableAutoConfiguration(exclude = {VelocityAutoConfiguration.class})
public class Application {
Run Code Online (Sandbox Code Playgroud)

但是一旦应用程序启动,我仍然会得到一个velocityViewResolver bean.

知道如何禁用这种自动配置吗?

提前感谢您的回复.

ygl*_*odt 9

使用Spring Boot 1.2.5,禁用主应用程序类上的自动配置似乎就足够了:

@SpringBootApplication
@EnableAutoConfiguration(exclude = { VelocityAutoConfiguration.class })
Run Code Online (Sandbox Code Playgroud)

编辑 我不确切知道什么时候有效,但是现在(Spring Boot 1.3.2)你也可以设置:

spring.velocity.enabled=false
Run Code Online (Sandbox Code Playgroud)

在application.properties中.