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

Error starting Jetty
How to notify Grid when new object was added to model
Ho to change ListView items count?
JPA query for getting list of objects which are in one To Many relationship
Type mismatch: cannot convert from String to
Configuring BasicDataSource properties within Tomcat JNDI Resource
how to pass a value from one test case to another in selenium webdriver
Java OpenCV (bytedeco) and BOWImgDescriptorExtractor
Swapping JButtons in Java
Java: why the array's length is 1 when nothing is in it
h2 database: Unsupported database file version or invalid file header in file
Does Spring automatically Autowire constructor args in java bean definitions?
Graph representation in Java using linked structure
Disable Subject Alternative Names (SAN) verification on self-signed certificates
Dom4j - No such namespace prefix
ActiveMQ WebSocket flooding the log with NPE warn

Categories

HOME
coq
deezer
hashmap
relayjs
mean-stack
electronics
installshield
enterprise-library-5
iggrid
volttron
modx-revolution
google-cloud-spanner
alignment
fortumo
footer
reactcsstransitiongroup
connection-string
interop
firefox-webextensions
kryo
autoconf
jasonette
errorlevel
kvc
mustache.php
claims-based-identity
pepper
apache-commons-io
poltergeist
selectedindexchanged
fgetcsv
nhapi
elasticsearch-ruby
galsim
lxd
hybridauth
plsql-psp
swift3.0.2
serverside-rendering
android-browser
azure-ml
greenrobot-eventbus
cookiecutter-django
http-live-streaming
jvm-languages
isbn
checkboxlist
menuitem
rdfs
pearson
arrow-keys
nbconvert
dstu2-fhir
mikroc
asp.net-4.5
mathematica-frontend
blackberry-10
fadeout
yaws
dataview
historian
xna-4.0
wso2cloud
jmeter-maven-plugin
sailfish-os
python-green
website-monitoring
tween
terminfo
mesa
typeof
p4java
valuechangelistener
undefined-reference
datagridviewcolumn
concurrent-collections
cloud-connect
intentservice
flexmojos
quartz-graphics
file-locking
shellexecute
mylyn
referrer
path-separator
mt
quickdialog
dsn
errai
netdna-api
javax.script
table-footer
inotifycollectionchanged
mongomapper
jmock
google-friend-connect
ti-dsp
privilege
gacutil
putchar
msdev
misv
ntvdm.exe

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
Mobile App
Mobile App
Mobile App