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

MySQL SQL Syntax error on GUI
Implementation of congruence in java
Attempt to invoke virtual method '…' on a null object reference [duplicate]
API 25 Changing language in APP
Non-blocking HTTP requests on HttpHandlers
Update object mapped to string using ObjectMapper
Why I can't deploy on Tomcat? Could not publish server configuration for Tomcat v7.0 Server at localhost. Multiple Contexts have a path of “/ROOT”?
How to write unit test of Vertical (vert.x application) using mockito and junit
Is it possible to stream double values from an array using scanner?
convert long to timestamp when downloading dates from BigQuery - java
if condition in logback - print log messages in two different folders
Java streams: group and sort by a previous mapping result?
Testing a rest service with JUnit
Options for calling IMS Transactions
Why the panel is not showing up?
how get and load method of hibernate work in second level cache

Categories

HOME
yii2
atom-editor
isabelle
tizen
plone
session
kalman-filter
rsync
filtering
malloc
gps
cross-browser
adobe-analytics
dax
moonmail
text-rendering
karma-jasmine
lldb
zapier
object-detection
orleans
crosstab
javacv
apache-commons-io
intel-pin
rst2pdf
maquette
ejabberd-module
dbclient
atlassian-crucible
junit5
bosh
data-manipulation
http-get
column-family
vsts-build-task
fusionpbx
android-browser
xenforo
streamreader
quadratic-programming
unixodbc
netcdf4
acoustics
reactive-cocoa-5
avconv
scrollable
chain-builder
pubmed
dandelion
datastax-startup
dtexec
ifs
nested-sets
abcpdf9
android-fonts
phishing
multi-level
underscore.js-templating
asp.net-4.5
jwplayer7
skype4py
spim
vstest.console.exe
iiviewdeckcontroller
key-management
e10s
rake-task
c3
camanjs
gui-test-framework
rdtsc
dml
funcunit
wp-query
soundtouch
android-screen-support
kyotocabinet
sublist
isnullorempty
quickdialog
rdoc
datawindow
pysimplesoap
cascalog
errai
ohm
hgsubversion
libc++
gnustep
stage
celltable
site.master
coda-slider
icanhaz.js
forums
swing-app-framework
sector
putchar
genealogy

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