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

LibGDX tile map flickering when camera moving
Calculator returns 0.0 to all questions asked
actual argument long cannot be converted to int by method invocation conversion
Build non-http socket based service with undertow
Sending string and picture over java sockets: server not receiving string or picture from android client
Android native libs disappearing once app is installed
Spring with Hibernate JPA - runtime errors
Key listener java - number limitation
Unable to get jndi data source
How to update soundpool?
How to escape a URL for Elasticsearch?
mongodb DAO sets all attributes to null before save()
Spring data jedis connection pool configuration [closed]
Artifactory maven-metadata.xml and bundles with Java API
Get the current network time on Android [duplicate]
java socket - handling client disconnection [duplicate]

Categories

HOME
compiler-construction
openlayers
react-virtualized
iot
electron
spagobi
elm
retrofit
windows-server
node-pdfkit
n-gram
task
dynamics-crm-online
dosgi
tostring
google-cloud-speech
zapier
kryo
paging
java-3d
format-specifiers
brunch
social-media
ping
flink-streaming
preg-match
key-value-observing
oracle-fusion-middleware
google-qpx-express-api
avcapturesession
picasso
dartium
objectlistview
vapor
uft-api
sqlite2
sql-server-agent
checkboxlist
angular2-meteor
paxos
togetherjs
nativeapplication
diagnostics
feeds
jspdf-autotable
crosswalk-runtime
word-vba-mac
nxt
httplistener
android-textview
login-control
skobbler-maps
django-debug-toolbar
python-stackless
dlna
bluegiga
livequery
cloudbees
iad
marching-cubes
metaclass
content-length
coveralls
cakephp-3.1
generic-programming
composite
pretty-print
umbraco6
camanjs
coldbox
asp.net-dynamic-data
relocation
javafx-webengine
client-side-templating
eol
sgen
funcunit
jubula
phpthumb
mechanize-ruby
srs
ftps
easy-install
interface-orientation
limejs
mt
broken-links
gcj
heartbeat
coredump
xdomainrequest
calling-convention
memory-size
virtual-functions

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