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 do you execute cURL statements in java to fetch JSON from kibana
Constructor for a class whose super should only be made via factory method
Introducing EhCache broke web app (no error message)
Java String Error Out Of Bounds
Playframework 2.5 SQL error or missing database (no such table: information_schema.sequences)
ClassCastException Error while dynamically loading classes from a JAR file outside WAR at run time in JAVA?
Java: How to get the jdbc oracle driver after download by user?
Configuration for creating multiple instances of hazelcast in a single JVM
How to add a Intellij project to netbeans
Exception while loading Java access bridge though java agent
Use com.google.android packages in non-Android Java apps
Why is the main method in superclass executed by JVM? [duplicate]
Why are 3-letter abbreviations for US timezones inconsistent with respect to daylight savings?
How do I create regular expression for a string to match [#username:4]?
Is there any Alternative of --guess in java runcukes
Android Clone Locally Maven Repository

Categories

HOME
ionic-framework
openlayers
variables
coq
webpack
c#-4.0
path-finding
onedrive
syntax
gps
angular-ui-bootstrap
cross-browser
datastax-java-driver
ios-charts
autotools
midi
qt-creator
timeout
ibm-odm
caml
netflix
dosgi
clojurescript
libtiff
visual-composer
predix
captiveportal
microsoft-r
sqlcipher
underflow
strncpy
gsmcomm
bluestacks
junit5
galsim
oracle-fusion-middleware
google-qpx-express-api
fog
azure-sql-database
accelerate-framework
wallpaper
dartium
bitbucket-pipelines
lto
neuroscience
libraries
event-driven
libvpx
starteam
opshub
graphenedb
optix
grid.mvc
google-closure
spring-security-kerberos
acoustics
businessworks
appcompat
filepicker
dds
pebble-watch
brightcove
drupal-6
forever
snmptrapd
ifs
color-profile
multi-level
plottable.js
qcustomplot
yaws
asp.net5
independentsoft
wso2cloud
android-listview
ideamart
myo
operation
asp.net-dynamic-data
heisenbug
sgen
uitouch
kgdb
oracle-warehouse-builder
centos5
cdc
google-cloud-save
buster.js
spring-validator
http-unit
anonymous-methods
runas
viewswitcher
getmessage
uiviewanimation-curve
libc++
hirefire
invite
locationlistener
blitz++
modelstate
project-hosting
multiple-languages
rtml

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