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

why is one for-loop faster than the other even though they do the “same”? [duplicate]
Java webapplication deploymant with relational databse
Moveing files with java
make phone call when specific notification arrive
Drawable resource not found, but present
While loop w/ if statement won't follow sucesive if statements
figuring out the size of object to handle max item size in dynamoDb [duplicate]
HTTP 404 - There is no Action mapped for namespace [/modeldriven] and action name [datosUsuario] associated with context path [/FormularioMD]
How can I debug processing of hibernate.hbm2ddl.import_files value combined with hsqldb?
How to include jars that load other jars in maven?
How do I align a graphic in iTextPDF?
tomcat 8: A child container failed during start [closed]
When passing an array reference, how to change the reference to some other array? [duplicate]
Java Generic Types and Entry
Glass update to XE22, custom voice command with glassvoice.jar not work
Logic error using equals method

Categories

HOME
single-sign-on
kde
hashmap
iot
rsync
survey
google-project-tango
bs4
floating-action-button
modx-revolution
etl
apache-cayenne
gz
size
visual-studio-2005
quickfix
decomposition
serverless-framework
footer
normalizr
samoa
openedx
kryo
xlsxwriter
wkwebview
extjs5
tibco-mdm
php-openssl
shopware
instant-messaging
uisplitview
gtrendsr
uiswipegesturerecognizer
openoffice.org
io-redirection
serve
automake
dism
g-code
eigenvalue
bootstrap-dialog
acoustics
sencha-touch-2.3
wso2carbon
angular-resource
menuitem
upstart
python-webbrowser
alphabet
statsd
google-perftools
windows-mobile-6.5
r-forge
dynamics-sl
webdriverjs
vtigercrm
google-cdn
bonobo
skobbler-maps
fadeout
wapiti
srand
tmuxinator
cakephp-3.1
microbenchmark
arcanist
myo
unity3d-gui
iiviewdeckcontroller
python-green
google-style-guide
android-nested-fragment
php-5.4
openlaszlo
xsockets.net
ora-00911
eclipse-memory-analyzer
html4
qt-faststart
angularjs-controller
dsn
labwindows
semantic-diff
php-parser
external-accessory
xdomainrequest
cinema-4d
javax.script
lang
gamequery
filtered-index
nhibernate.search
bespin
firefox4
simpletest
project-hosting
mdac
multiple-languages

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile