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

Deserializing into class extending LinkedHashMap with Gson
Adding external library to a LibGdx project
Change method's return type dynamically
Pass Strings from one activity to normal class
Need Help sorting out nested for loops
JavaFX Using Stage on ViewModel
Return Map with same key and different value separately?
How to send data to servlet from android application in android studio? [duplicate]
I cannot write file to hdfs
JasperReports:java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character
Reading the user input from the console & writing it to JSON
Checking for correct number of ( [ and { in expressions?
Implementing a Generic Double Linked Class with refer to current obeject
Java charAt unexpected type error
How to add user input to array
Converting to binary - getting IndexOutOfBoundsException

Categories

HOME
log4j
hive
proxy
openstack
path-finding
json.net
webstorm
ckeditor
angular-ui-bootstrap
flyway4
add
izpack
ups
caml
serilog
object-detection
facebook-instant-articles
java-7
angular2-aot
poltergeist
wtx
jspm
noraui
windows-dev-center
geopositioning
appfabric
dosbox
preconditions
quadratic-programming
convertapi
cubic-spline
clean-architecture
return-value
worker-thread
directory-structure
query-performance
medium.com
visual-c++-2008
deadbolt-2
merge-conflict-resolution
firebaseui
gridview-sorting
multiple-regression
ios4
r-tree
eclipse-clp
feedback
tmuxinator
iis-arr
muse
sankey-diagram
web-controls
lustre
android-nested-fragment
android-imagebutton
google-reader
android-2.2-froyo
access-rights
dataservice
spring-validator
tinn-r
unc
mt
nsnetservice
removeclass
whoosh
gnu-prolog
invite
appendto
imac
html-input
thunderbird-lightning
compiler-specific
nintendo-ds
javap
ti-dsp
sustainable-pace
msdev

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile