alebu
alebu

Reputation: 513

How to get access and customize Freemarker's Configuration object in spring-boot 2.x?

How to get access and customize Freemarker's Configuration object in spring-boot 2.x?

It allows to set square bracket syntax as default option with something like:

Configuration#setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX)

which is not possible with any of spring.freemarker.* configuration property.

Also, it should be possible to introduce default imports having access to direct configuration of this object.

Upvotes: 0

Views: 1411

Answers (1)

ddekany
ddekany

Reputation: 31152

It's possible to set any FreeMarker configuration settings with spring.freemarker.settings.<settingName>, like spring.freemarker.settings.tagSyntax = square_bracket. See the JavaDoc of Configuration.setSetting(String, String) for more (https://freemarker.apache.org/docs/api/freemarker/core/Configurable.html#setSetting-java.lang.String-java.lang.String-). This is the method to which Spring delegates the assignments under spring.freemarker.settings; Spring itself doesn't know what "settings" exist or how to parse them.

Upvotes: 1

Related Questions