Our great sponsors
-
ABP
Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
It turns out that Spring Boot randomly changed the file extension from .ftl to .ftlh. But none of the online tutorials out there were updated for it. I only found out because I noticed the different version numbers in my pom.xml, compared to the random sample project, and tracked down the changelog. This situation would be less likely to happen, if there was good, detailed, friendly documentation from the official sources. Googling "spring boot freemarker" gets you a lot of third-party tutorials, and one ancient document for the big, scary, configured-via-XML, ultra-enterprisey Spring Framework.
Check ABP: https://abp.io/
For example, it took me about 2 hours of questioning my sanity to set up a hello world with HTML templating. I started with Spring Initializr (which has an intimidating list of things to choose for a project). I picked all the web stuff I wanted (eg. Spring Data JPA, Spring Security), and for the template language, I picked Freemarker, because it was the sanest option for HTML templating. I then found a simple tutorial covering Spring Boot and Thymeleaf. The tutorial told me to create a controller, and a method for my route, that returns "hello", and to put my template in resources/templates/hello.ftl. That sounds simple enough, but it didn’t work. Tried another tutorial, same result. Tried downloading sample code from one of the tutorials, and now it works.
FreeMarker itself is an external dependency. The support for using FreeMarker in Spring is part of Spring Web MVC. The default file extension configuration is part of Spring Boot. My issues were caused solely by code that is in repositories owned by the @spring-projects GitHub organization. I wouldn’t consider those to be external dependencies, even if they happen to live in different Maven packages.