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 activity doesn't work when kept in Tab/Swipe view fragment
Java Spring MVC forward/redirect POST request using interceptor
Entity manager #Enumerated(EnumType.STRING) - how can I make it use toString()?
ArrayLists and HashMaps are recommended to use in Java?
Android virtual KeyBord and Edit Text
Click on NavigationDrawer does not change Fragment with ViewPager
How to switch workspace in jackrabbit-standalone command line (cli)?
#Consumes({“application/xml,application/json”}) how to program the return type
Accesing request attribute in jsp not having direct access to request
scene2d ui - how to make a grid / table?
Data structure with logarithmic insert/delete and “no-greater-than”
Using an RSA Public Key generated by JavaScript from Java
What is the id of the listener container when using Spring's JMS namespace?
NoSuchBeanDefinitionException with Spring and Hibernate
Scanner reading inputs but outputting previous inputs [duplicate]
Finding the Min and Max numbers using Dialog boxes Java

Categories

HOME
client
pypi
gerrit
gremlin
paw-app
twitter-bootstrap-4
v8
c#-2.0
jpeg
blueprintjs
indesign
adfs
applepay
adobe-analytics
postgres-xl
google-apps-marketplace
spring-tool-suite
alignment
percona
libtiff
connection-string
text-rendering
lldb
physics-engine
intentfilter
h2db
virtualdub
neo4j-spatial
libssl
c++-amp
microsoft-chart-controls
binary-data
google-cloud-endpoints-v2
uisplitview
protovis
form-data
mapdb
io-redirection
x11-forwarding
lto
streamsets
code-search-engine
core-plot
sencha-touch-2.3
scorm
network-flow
upstart
jlink
winscp-net
gabor-filter
typed-lambda-calculus
jspdf-autotable
synchronous
deadbolt-2
phishing
nsfilemanager
bstr
fuzzy-search
qgraphicsview
php-parse-error
associative-array
execute
thredds
intellij-14
feedback
kcachegrind
arcanist
clipperlib
apache-commons-net
javax.mail
fscommand
sorl-thumbnail
rake-task
dd
java.util.concurrent
relocation
phalanger
responsive-slides
elliptic-curve
kgdb
braille
bundles
geos
inbox
html4
plasma
pygit2
eventlistener
wsdl-2.0
e4x
simba
browser-detection
automount
regsvr32
chrono
netdna-api
boost-filesystem
vdsp
genshi
infobox
servicehost
imac
site.master
routedevent
forums
backcolor
yagni

Resources

Encrypt Message