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

How to create a JTable without directly assigning values
Java jacksonGeneric Serialization
Deploying a vaadin app to tomcat
Using JAVA to create Excel file: The workbook already contains a sheet of this name
why is this algorithm so slow?
Java android How I can onFailure in socket . How I can check a request is success?
JavaFX Change GUI from other Thread [duplicate]
Nominative Month Name for Different Locales in Java 8
“Unable to complete operation. Invalid parameter” Error binding the Java library org.ksoap2
Logging possibilities in a JRE Extension
Business event handling
RabbitMQ Queue Max Priority Issue
how to add to the x bounds of a jlabel upon button press
Appium-Java : Getting “session could not be created ”error while executing below android app automation code
Broadcast using TCP protocol with sockets in JAVA
Android UnknownHostexception but Permissions granted

Categories

HOME
google-chrome-extension
listview
include
fingerprint
pivotal-cloud-foundry
django-imagekit
bs4
android-youtube-api
reveal.js
collectd
static-libraries
ibm-odm
flask-wtforms
quickfix
designer
windows-7-x64
solaris-10
http-status-code-504
text-rendering
oxyplot
textfield
conemu
ml
cx-freeze
css-animations
kvc
kudan
rundeck
one-to-many
sparse-matrix
dynamic-featured-image
intel-pin
applozic
elasticsearch-net
replaceall
gitignore
socialengine
google-qpx-express-api
kendo-ui-grid
azure-sql-database
android-ble
wixsharp
io-redirection
simplexml
xenforo
ruby-on-rails-3.1
estimote
http-redirect
gpx
babel-core
rainbowtable
osx-mavericks
strptime
worksheet
gabor-filter
recursive-datastructures
brightcove
snmptrapd
android-cursor
flow-control
arrow-keys
orthogonal
chord-diagram
wdf
url-pattern
storekit
gstreamer-0.10
skype4py
bluegiga
rhino-servicebus
spim
lemon
t4mvc
spidermonkey
responsive-images
ideamart
event-bubbling
mono-embedding
e10s
bigbluebutton
geonetwork
csquery
dia
gui-test-framework
zend-route
jquery-layout
reactfx
viadeo
html5-notifications
page-layout
blending
ora-00911
smtp-auth
path-separator
bluepill
broken-links
reddot
buildr
doh
coercion
self-extracting
radcombobox
libs
microsoft-virtualization
exchange-server-2003
ti-dsp
pascal-fc

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile