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 decide which collection should be used from List Set? [duplicate]
Components render an unusal way
JOGL + JButton canvas only updated when window is resized
Best approach to find matching records in two JSON Files
The read from a TCP Server hangs when reading more than once
Why I obtain this error when I try to build a Java.utile.Date object from a String?
declare java.util.Map into json-schema
Use Matcher to return item in Collection
org.json.JSONException: JSONArray[0] is not a JSONObject
Create native android apk via command line only (makefile)
JAVA mail api: Why you need Multipart in order to send email with attachment?
Do JFrame windows in Swing run on their own separate threads?
How to switch back to parent window in Selenium WebDriver?
Java pass method reference as parameter to other method
Detecting MIME-Type from DataHandler
How to use Selma's mapper to convert pojo with Lombok's annotations

Categories

HOME
openstack
drivers
syntax
youtube-dl
setup-deployment
react-redux
twitter-bootstrap-4
ebean
qore
portia
amazon-cloudformation
google-translate
tomcat6
floating-action-button
imacros
quickbooks
resize
moonmail
fallback
jsprit
netflix
dosgi
openrefine
jtextfield
grails3
autocad-plugin
object-detection
cx-freeze
jquery-ajaxq
cloudhub
pingfederate
traffic
fgetcsv
rst2pdf
ejabberd-module
log4js-node
atlassian-crucible
c++-amp
bpel
nat
oracle-fusion-middleware
google-qpx-express-api
subset-sum
android-nestedscrollview
main
disassembling
scaffold
code-search-engine
opshub
unoconv
ruby-on-rails-3.1
nomethoderror
segment
flickr-api
upstart
errordocument
jquery-nestable
promela
hendrix
fancybox-2
aurelia-validation
crypt
pg-dump
gcsfuse
bind9
angular-cache
file-writing
mongocsharpdriver
jwplayer7
prettytensor
fadeout
reactive-banana
lemon
metaclass
content-length
quicklisp
census
dereference
operator-precedence
gwidgets
java.util.concurrent
fpml
markers
typeof
tld
typo3-neos
stxxl
prettify
geos
spring-io
ruby-datamapper
gwt-rpc
random-seed
drools-planner
word-processor
dbproviderfactories
getmessage
whoosh
data-loss
hirefire
invite
yetanotherforum
paster
sortable-tables
multi-tier
avatar
ugc
commodore
windows-live-messenger

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