# 71.9 Velocity

默认情况下，Spring Boot会配置一个`VelocityViewResolver`，如果需要的是`VelocityLayoutViewResolver`，你可以自己创建一个名为`velocityViewResolver`的bean。你也可以将`VelocityProperties`实例注入到自定义视图解析器以获取基本的默认设置。

以下示例使用`VelocityLayoutViewResolver`替换自动配置的velocity视图解析器，并自定义`layoutUrl`及应用所有自动配置的属性：

```java
@Bean(name = "velocityViewResolver")
public VelocityLayoutViewResolver velocityViewResolver(VelocityProperties properties) {
    VelocityLayoutViewResolver resolver = new VelocityLayoutViewResolver();
    properties.applyToViewResolver(resolver);
    resolver.setLayoutUrl("layout/default.vm");
    return resolver;
}
```
