Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Spring Boot's autoconfiguration for Apache Velocity?

I'm experimenting with Spring Boot (1.1.9.RELEASE) and Apache Velocity (1.7) with the intention of using Velocity as a templating tool for generating emails. I'm using Thymeleaf (2.1.3.RELEASE) for web templates.

Spring Boot's Autoconfiguration detects Velocity on the classpath during start up and adds it as a web view resolver. While this is brilliant, it's not what I want so I tried

@EnableAutoConfiguration(exclude = {VelocityAutoConfiguration.class})
public class Application {

but I still ended up with a velocityViewResolver bean once the application had started up.

Any idea how I might go about disabling this automatic configuration?

Thanks in advance for any replies.

like image 695
Don'tWantTo Avatar asked Nov 26 '14 11:11

Don'tWantTo


1 Answers

With Spring Boot 1.2.5, disabling the autoconfiguration on the main application class seems to be enough:

@SpringBootApplication
@EnableAutoConfiguration(exclude = { VelocityAutoConfiguration.class })

Edit I don't exactly know since when that works, but now (Spring Boot 1.3.2) you can also set :

spring.velocity.enabled=false

in application.properties.

like image 158
yglodt Avatar answered Sep 30 '22 14:09

yglodt