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

NumberFormatException when trying to convert JTextField to int
MapReduce with Recursion
Java double x 10/4=2?
JList's TransferHandler.createTransferable() and .exportDone() not called
Java Apache POI Opening file? [closed]
Radio Button with Action Listener
Azure MobileService returns NullPointerException (Android)
Bootable program
Why does my Java PriorityQueue behave strange
adding string to certain char
I have a consistent error with my source
achartengine setLabelsTextSize doesn't apply to annotations of all renderers
Unkown NullPointerException
Queue array implementation resize
Couldn't connect to a firebird database from javaFX application in Raspberry Pi
Using Spring and Jersey together

Categories

HOME
variables
testng
listview
hook
gerrit
openmp
amazon-ec2
keycloak
server
pycharm
mfc
session
webstorm
windows-server
ojdbc
django-imagekit
directx
portia
paradox
primary-key
ssl-client-authentication
timeout
n-gram
pythonanywhere
jqwidget
beyondcompare
textfield
amazonsellercentral
kryo
abi
tapestry
hammerspoon
trading
opentype
instant-messaging
stormpath
google-qpx-express-api
grails-3.1
protovis
subset-sum
restlet
swift3.0.2
lumberjack
eclipse-scout
fedex
pdf-reactor
password-encryption
websphere-mq-fte
pango
dandelion
aurelia-validation
lowpass-filter
windows-iot-core-10
cudafy.net
minimization
root-framework
sts-springsourcetoolsuite
file-writing
xml-attribute
simplewebrtc
superstack
energy
marching-cubes
retina
appfabric-cache
graph-drawing
remobjects
apache-commons-net
modalpopup
qpainter
internet-connection
code-access-security
transcoding
message-driven-bean
ocunit
cassini-dev
tinn-r
bitsharp
runas
datawindow
twrequest
online-compilation
postgresql-performance
php-parser
xtype
winbugs14
avatar
3gp

Resources

Encrypt Message