Skip to content

Commit f580123

Browse files
committed
Merge pull request #32030 from mdeinum
* pr/32030: Remove use of reflection in MustacheViewResolver Closes gh-32030
2 parents cea6492 + 3b41071 commit f580123

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolver.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
* Spring WebFlux {@link ViewResolver} for Mustache.
2828
*
2929
* @author Brian Clozel
30+
* @author Marten Deinum
3031
* @since 2.0.0
3132
*/
3233
public class MustacheViewResolver extends UrlBasedViewResolver {
@@ -75,4 +76,9 @@ protected AbstractUrlBasedView createView(String viewName) {
7576
return view;
7677
}
7778

79+
@Override
80+
protected AbstractUrlBasedView instantiateView() {
81+
return (getViewClass() == MustacheView.class) ? new MustacheView() : super.instantiateView();
82+
}
83+
7884
}

0 commit comments

Comments
 (0)