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

android sqlite database returns nothing
how to get value through one class to another through intent?
Tomcat and Database references
java executable jar file not working to another computer
SelecAll functionality for items in jcheckbox list using swings in java
Android studio Navigation drawer and map
How do I get a label to add its value to an integer field or column in a table view in javafx
Generate all possible strings optimization
Not Able to call SOAP Webservice with domain name
Standford NLP giving exception while running code
Java error message array in other method [duplicate]
How to update each row of a jtable for jbutton action [duplicate]
JPA 2.0 is not showing the tables in the schema in myEclipse professional 2013
Streams : Calculate the difference of totals in one go
Java - Why declare an array as a type of Interface?
Write into text file

Categories

HOME
ibm-bluemix
zeromq
magnific-popup
minimum-spanning-tree
objectgears
filtering
tizen-web-app
android-youtube-api
modelica
carthage
designer
dosgi
pc
reactive-cocoa
undefined
plunker
reverse-proxy
wkwebview
mmap
hammerspoon
filezilla
jaxb2
librato
microsoft-chart-controls
bluestacks
http-status-code-503
preg-match-all
grails-3.1
y86
environment-modules
suricata
main
git-merge
angularjs-factory
ws-security
optix
g-code
elmah
janrain
vao
angular2-meteor
angular-resource
outlook-2013
osx-mavericks
react-scripts
datastax-startup
tropo
feeds
sqlbulkcopy
pdfclown
spring-mongodb
dwscript
pycaffe
firmata
clang-static-analyzer
lua-5.1
pickadate
captivenetwork
asp.net5
cloudbees
historian
teamcity-8.0
jmeter-maven-plugin
iis-arr
cakephp-3.1
sailfish-os
vstest.console.exe
unity3d-gui
modalpopup
applescript-objc
preferences
responsive-slides
transcoding
html5-notifications
mysqltuner
xsockets.net
seed
free-variable
angularjs-controller
isnullorempty
errai
eclipse-templates
deobfuscation
joyent
rfc1123
appendto
celltable
web-application-design
dentrix
filtered-index
microsoft-virtualization
adrotator

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App