Thymeleaf loading templates from database on fly - spring

Iam new to thymeleaf and I am trying to send an email with a predefined template using spring mail and spring thymeleaf. I could able to send an email with a template in my templates folder, but i need to have a table which has different templates, and I need to read those template at runtime using template name, and utilize those template for sending email. I could not able to find a complete example which follows java based annotations in spring boot. can anyone share an example code with the explanation for the same?

Related

Dynamic Tags to Spring metrics

Is it possible to add dynamic tags to default spring metrics using micrometer?
I am trying to add a custom tag to http default metrics that spring provides.
I got this answer which explains how to add common tags How to define additional or custom tags for default Spring Boot 2 metrics?
but what i want to know is if i can add the new tag dynamically instead of hardcoding the value as in the other answer?

spring boot admin UI customization

I would like to customize the spring boot admin ui to put some custom urls for healthcheck.I didn't find any examples on altering the UI like adding some tabs or putting some urls etx.
I found some documentation under http://codecentric.github.io/spring-boot-admin/current/ but it wasn't helpfull.
Any help on this would be really appreciated
Spring boot admin uses vue.js for frontend.
It is possible to add custom views to the ui. The views must be implemented as Vue.js components.
The JavaScript-Bundle and CSS-Stylesheet must be placed on the classpath at /META-INF/spring-boot-admin-server-ui/extensions/{name}/ so the server can pick them up. The spring-boot-admin-sample-custom-ui module contains a sample which has the necessary maven setup to build such a module.
The custom extension registers itself by calling SBA.use() and need to expose a install() function, which is called by the ui when setting up the routes. The install() function receives the following parameters in order to register views and/or callbacks:

Is there any mustache template for adding logging or exception handling when generating spring boot api using swagger-codegen-cli-2.3.1?

I have searched for this template but couldn't find one.
Is there any editor to generate mustache template for spring boot.
Please let me know how to modify existing mustache template to suit requirements.
If the author of the template didn't write any logging features within the spring boot template you
will have to modify the template yourself. Instructions on using the generator with local template files can be found here
templates
You will have to download the spring template folder and the according java class if you don't want to clone the complete codegen project.

Spring MVC template engin vs plane html

I'm a little confused about template engines like thymeleaf or velocity.
My question is are there any profits from using template engine instead plain html + angular?
I'm asking because I'm developing application using
Spring boot 1.3.2
Angular 1.4.8
Thymeleaf
and I'm wondering if is a chance in Spring MVC application that I'll nead template engine instead make it all in plain hmtl + angular?
AngularJS is as client-side Javascript framework.
Thymeleaf is a server-side template engine capable of create HTML, CSS, Javascript and text.
You can use both to create your web app.
For instance you can send to your customers already processed pages by Thymeleaf with the client specific data. As the customer interacts with your page you can use AngularJS to bring data from your server via Ajax or to process his requests locally, so your server will not need to send the entire page to your customer as he interacts with your page, this will make your page faster.

Something like Spring's VelocityEngineUtils that can use URL to template

I'm using Spring and Velocity templates to send emails. The new request is that the templates are no longer stored locally, but fetched from an external service. VelocityEngineUtils expects a relative path to the template, but all I now have is an URL. While I'm aware that I can fetch and save the template locally before calling VelocityEngineUtils, I'm asking if there already is something in Spring that can help (as it often happens).
what velocity resourceloader you are using at the moment? I assume that you are using ClasspathResourceLoader?
If you need to get velocity template from an external service through a URL, you can specify the resource loader to org.apache.velocity.runtime.resource.loader.URLResourceLoader

Resources