java


How to force my template resolver to use ClassLoaderTemplateResolver for /mail/* templates


I am using two template resolvers for my Spring Boot Application ServletContextTemplateResolver and ClassLoaderTemplateResolver.
I am using ServletContextTemplateResolver for /WEB-INF/* html templates for my web pages. I will on the other hand, use ClassLoaderTemplateResolver for my /mail/ html templates. Here's the code:
#Bean(name ="templateResolver")
public ServletContextTemplateResolver getTemplateResolver() {
ServletContextTemplateResolver templateResolver = new
ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("XHTML");
templateResolver.setOrder(Integer.valueOf(1));
return templateResolver;
}
#Bean(name ="emailTemplateResolver")
public ClassLoaderTemplateResolver getEmailTemplateResolver() {
ClassLoaderTemplateResolver templateResolver = new
ClassLoaderTemplateResolver();
templateResolver.setOrder(Integer.valueOf(2));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".html");
return templateResolver;
}
It shows the following error when calling the mail template:
Resource resolution by ServletContext with
org.thymeleaf.resourceresolver.ServletContextResourceResolver can only
be performed when context implements org.thymeleaf.context.IWebContext
[current context: org.thymeleaf.context.Context]
How can I force it to use ClassLoaderTemplateResolver for /mail/* templates?

Related Links

JPA - My Named Query won't work
Cascaded combo boxes java
Android Vertical Switch Widget
Getting GoogleApiClient to work with Activity Recognition
Android structuring / naming of classes
How to program behavior of a void method with Mockito? [duplicate]
Couldn't able to read the attribute using DOM parser
Java string comparison with object string
Multiple buttons. Passing actions to the next button in Java
Autowire a Spring service in JUnit test
JBoss AS 7 and MySQL - Can't start server
Java - JPanel vs Canvas
Java: How to remove duplicate string array from ArrayList?
Spring Boot test class wont inject beans
Using unique variable names in Xtend loop (Code Generation)
Using Scanner.in with java Applet

Categories

HOME
testing
gerrit
isabelle
drivers
read-eval-print-loop
spring-jdbc
yarn
serverspec
paradox
cross-validation
add
cloudkit
maude-system
windows-10-universal
tomcat6
imacros
google-cloud-spanner
spring-tool-suite
commonmark
orchardcms
fortumo
iron-router
serilog
conemu
visjs
sylius
google-search-api
blazemeter
rundeck
crystal-reports-2010
angular2-aot
status
selectedindexchanged
kannel
traffic
kendo-datasource
skia
sql-server-2012-express
directx-10
gtrendsr
http-get
column-family
webtest
ghost4j
http-referer
mmenu
overlap
vxworks
libvpx
cookiecutter-django
awt
glew
keydown
gpx
qcombobox
fault
winscp-net
dtexec
windows-mobile-6.5
dynamics-sl
sonarlint-vs
crosswalk-runtime
pintos
sts-springsourcetoolsuite
intrusion-detection
gstreamer-0.10
superstack
srand
comobject
ruby-2.2
tmuxinator
iis-arr
jqgrid-formatter
sframe
twirl
formatjs
facebook-graph-api-v2.4
oxwall
xcode-6.2
issuu
rdl
document-classification
onactivityresult
ceil
typeof
tld
elliptic-curve
java.nio.file
prettify
ms-project-server-2010
gridfs
apc
google-cloud-save
dataadapter
cassini-dev
referrer
automount
hosts-file
online-compilation
reddot
custom-backend
cinema-4d
locationlistener
ecl
calling-convention
krl
w3wp.exe
digest-authentication
sortable-tables
audio-capture
sef
virtual-functions
eqatec
project-hosting
sector
gacutil
putchar
private-members
post-build

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html