Search code examples
springspring-bootthymeleafresttemplate

When do we use Spring Boot templates?


When do we use spring boot templates?

I understand that they're used with templating engines such as thymeleaf but I'm confused as to when to use them.

For example; Is this merely for testing purposes and once published we're done and ignore the templates and the web designer / developer has to implement the service or is this something that's part of our application and can't be removed?

Because, to me, it wouldn't make sense for us to pile all of our website html/css/etc inside the same package / project folder that we use to deal with server side stuff?


Solution

  • There is no such thing as Spring Boot templates. Spring Boot integrates with different templating engines where Thymeleaf is one of the (more popular) possible choices.

    With Thymeleaf you render the HTML on the server side using a combination of Java code (in the Spring MVC @Controller classes) and the HTML based Thymeleaf templates. The rendered HTML is then returned to the browser where it is rendered into what the user sees.

    As such, it makes perfectly sense to package it as part of the Spring Boot application, as it is what runs on the server.