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

Validate collection is not empty in Spring Data query parameter
How does Java Runtime annotation work internally? [closed]
How to update a custom view in Android
Android: How to send Header request to server using Volley :: Error
Define contra and co-variance for a generic object [duplicate]
How to fetch all many-to-many relations in minimum count of queries?
How liferay writes default.xml on ResourcePermission table?
NoUniqueBeanDefinitionException when injecting JpaRepository to Generic class
JavaFX tableView, when adding items to table A, table B take them too?
ANDROID JSON jsonObject with value shows NullPointerException error [duplicate]
java.lang.ArrayIndexOutOfBoundsException: length=4; index=6 [duplicate]
Using super and toString to update JTextArea
Is it possible to detect null references with JSoup?
Adding 1 one on to an integer each time? [closed]
How to decrypt an encrypted AES file using base64 Symmetric key and IV
Java file writer

Categories

HOME
arduino-uno
variables
drivers
kde
tesseract
webstorm
read-eval-print-loop
jsp-tags
getelementsbytagname
callback
mouse
uber-api
bs4
upload
session-variables
offline
static-libraries
hapi
decimal
designer
try-catch
openrefine
fatal-error
ef-migrations
openedx
viewport
emulator
java-3d
underflow
social-media
jaxb2
vision
c++-amp
binary-data
xquery-3.0
pim
asset-pipeline
http-referer
webix-treetable
streamreader
fedex
.net-4.6.2
logfiles
google-datalayer
network-flow
revapi
atomicity
idisposable
git-diff
colorama
magma
sybase-asa
python-cryptography
flow-control
bind9
blacklist
smart-table
firmata
android-textview
transmitfile
fuzzy-search
itextpdf
qtableview
0xdbe
interrupted-exception
method-parameters
mono-embedding
key-management
c++03
clicktag
codeigniter-url
id3v2
client-side-templating
xojo
mesa
typeof
starcluster
elliptic-curve
undefined-reference
concurrent-collections
cloud-connect
geos
ora-00911
interface-orientation
http-unit
cassini-dev
datawindow
dsn
gnustep
yui-datatable
pyinotify
jmock
preference
ncqrs
firefox-5
nintendo-ds
audio-capture
nerddinner
data-acquisition





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