Browse Source

Align MustacheViewResolver with other similar resolvers

The `FreeMarkerViewResolver` (and other template-based resolvers) in
Spring Framework avoid using reflection if they know how to
instantiate the view class. This change aligns with them.

See gh-24011
pull/24020/head
Dave Syer 5 years ago committed by Andy Wilkinson
parent
commit
22693c17f3
  1. 5
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/MustacheViewResolver.java

5
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/MustacheViewResolver.java

@ -75,4 +75,9 @@ public class MustacheViewResolver extends AbstractTemplateViewResolver { @@ -75,4 +75,9 @@ public class MustacheViewResolver extends AbstractTemplateViewResolver {
return view;
}
@Override
protected AbstractUrlBasedView instantiateView() {
return (getViewClass() == MustacheView.class ? new MustacheView() : super.instantiateView());
}
}

Loading…
Cancel
Save