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

Generate 2d Json Array In Java
Using code generation in order to generate test data
Extracting data from XML text
What is the difference between these declarations ? Is it related to one being mutable and the other being immutable?
can java return type write like Scala this.type
Is it possible to give dynamic directory structure in customized maven archetype
Reading webpage's inspect element data using java
RCP Application/SWT Label BOLD
JPA mapping multiple tables #OneToOne relationship with same composite key fields
how to increase maxTextMessageBufferSize value for websockets?
Java Apache Spark Streaming
Is it possible to read and write Parquet using Java without a dependency on Hadoop and HDFS?
Join from two tables to composite key in third table with JPA
Populate CustomListView using ArrayAdapter
Using a variable outside of forEach loop
MapReduce Array declared one

Categories

HOME
pdf
openlayers
ngrx
relative-path
hashmap
iot
grep
sd-card
rdf
pivotal-cloud-foundry
echarts
wamp
slurm
iggrid
kentor-authservices
commonmark
telephony
propel
karma-jasmine
kryo
kudan
format-specifiers
buildbot
virtualdub
bootstrap-material-design
minitab
ping
objectanimator
key-value-observing
google-qpx-express-api
fog
devextreme
simplexml
xenforo
squib
ws-security
sfdc
bootstrap-dialog
vao
babel-core
angular-resource
veracode
idisposable
sqlclient
boost-preprocessor
namecoin
arrow-keys
titanium-android
gridpane
azure-sdk
ado.net-entity-data-model
azure-virtual-network
dstu2-fhir
websitepanel
jwplayer7
blackberry-10
dataview
design-by-contract
oauth2client
xpath-1.0
msys
lemon
ora-00900
eclipse-clp
ruby-2.2
retina
wireshark-dissector
computer-algebra-systems
mmc
camanjs
google-style-guide
mdt
applescript-objc
php-5.4
terminfo
bundles
ember-charts
viadeo
imdbpy
terminal-services
flexmojos
gnu-smalltalk
file-locking
android-screen-support
smtp-auth
referrer
simba
gdata-api
venn-diagram
propertyeditor
datawindow
osql
jquery-ui-layout
table-footer
datareader
blitz++
coda-slider
nhibernate.search
castle-monorail
firefox-5
multi-tier
noscript
procedural-music
private-members
paul-graham
lzh

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