Thymeleaf 3.1 fails to render base64 image - TemplateProcessingException - spring-boot

I am migrating my application to Spring boot 3.0.1, and the thymeleaf version from 2 to 3.1
I have this line of code:
<img class="img-logo-main" src="#" alt="logo" th:src="#{'data:image/jpeg;base64,'+${logoMBase64}}" width="335" height="82">
which was executing normally before the upgrade, but now I am getting:
TemplateProcessingException - Caused by:
org.thymeleaf.exceptions.TemplateProcessingException: No configured link builder instance was able to build link with base "data:image/jpeg;base64,null" and parameters null (template: "my-template.html" - line 3, col 51)
NOTES: I am sending the logoMBase64 param. IDK why the log states null
Am I missing any configuration? Or have there been any changes in support for rendering base64 imgs?
Thanks!

Related

Thymeleaf don't expand data-<name> attribute on body tag

I have to downgraded a project with Spring Boot + Thymeleaf to make it work on Tomcat 7 for reasons of the production environment.
I have a Thymelead template where I collect some variables on HTML body tag:
<body th:title="${key}" th:data-key="${key}" th:data-rol="${rol}" th:data-iden="${iden}">
The title attribute was introduced to see that the variable 'key' is collected.
In the original project with Thymeleaf 3.0 (running on Tomcat 8.5) all the variables was collected but with the downgrade to Thymeleaf 2.1.6 only the attribute title is initialized.
Is there any possibility to make the template works with this approach?
I doubt there is a way to turn on that functionality in Thymeleaf 2, that being said the alternative syntax would be this (should work in all versions):
<body th:title="${key}" th:attr="data-key=${key},data-rol=${rol},data-iden=${iden}">

Broadleaf Community - SpEL error when using hibernate update instead of create

I am using the community demo site to get familiar with the Broadleaf offering. As a first step, we are trying to prevent the reloading of the database each server start. When I update the hibernate auto properties from 'create' to 'update'
blPU.hibernate.hbm2ddl.auto=update
blEventPU.hibernate.hbm2ddl.auto=update
the server will work (restart) a few times but eventually fail on start with the following error:
2018-11-08 08:51:46.226 ERROR 72159 --- [nio-8443-exec-8] org.thymeleaf.TemplateEngine :
[THYMELEAF][https-jsse-nio-8443-exec-8] Exception processing template "error": Exception evaluating SpringEL expression: "'locale-' + session.blLocale.localeCode" (template: "error" - line 12, col 7)
If I re-run the server with 'create' set, the server will start normally, but we've now lost any data customization.
Any ideas on why the database would need to be 'refreshed' for SpEL to pick up on this locale property?

Using Vaadin Error View instead of Spring Boot's Whitelabel error page

I'm using Spring Boot with Vaadin and. By using the #Autowired SpringNavigator, I have also set the error view:
navigator.setErrorView(ErrorView.class);
But when I type wrong URL like http://localhost:8080/asdf .
I always get the Spring Boot's Whitelabel error page. I know that I can set custom HTML page for the error like
/resources/public/error/404.html
but this is HTML way, I would like to use Vaadin with components,
the best solution would be the mentioned error view.

Thymeleaf Spring Property or field '' cannot be found on null

I am working on a project with Thymeleaf, Spring and Angular. I have a span in my html file which is as follows:
<span ng-if="isFurious == '1'" th:text="#{furious-message(${furious_bdate}, ${furious.edate)}" style="color:red;font-weight:bold;"></span>
And the relevent message property as follows:
furious-message=Object was from {0} till {1} in furious
I get the following error when page is loaded
**Whitelabel Error Page**
This application has no explicit mapping for /error, so you are seeing this as a fallback.
There was an unexpected error (type=Internal Server Error, status=500).
Exception evaluating SpringEL expression: "document.begin_date" (units:205)
In my Java console I have the following error:
Property or field 'bdate' cannot be found on null
'bdate' and 'edate' are coming from angular controller.
Kindly let me know if what am I doing wrong.
Thanks and Regards.

Grails - using Spring el expressions in Spring 3.1's #Cacheable

We're planning to use the Spring 3.1 cache abstraction instead of the Grails Spring cache plugin. I've experimented with it locally, but an issue occurred when using Spring el expressions like
#Cacheable(value = 'dashboardCache', key = 'sessionStorageService.getUser()', condition = 'sessionStorageService.getUser() != null')
public List<BusinessDashboard> getUserDashboards(String serverName, SessionStorageService sessionStorageService) { ... }
the following error occurs when executing the integration test case
EL1008E:(pos 0): Field or property 'sessionStorageService' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'sessionStorageService' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
I assume this behavior is caused by missing debug information - thus my question:
Can Spring el expressions be enabled in Grails apps, or is there any parameter to the compilation process to tell Grails to keep debug symbols in the class files?
(we're running on Grails 2.0.1)
you should try '#sessionStorageService.getUser()'

Resources