Package org.apache.juneau.rest.server.view.thymeleaf


package org.apache.juneau.rest.server.view.thymeleaf
Thymeleaf view-rendering bridge — opt-in juneau-rest-server-view-thymeleaf module.

Provides three sibling pieces that together let a Juneau REST resource render Thymeleaf templates:

Composition example (microservice):

@Rest(path="/app", mixins=ThymeleafMixin.class) public class AppResource extends RestServlet { @Bean ThymeleafMixin thymeleaf() { return ThymeleafMixin.create() .basePath("/templates/") .build(); } @RestGet("/hello/{name}") public View hello(@Path String name) { return ThymeleafView.of("hello").attr("name", name); } }

Engine-agnostic packaging:

The bridge module's main POM declares only org.thymeleaf:thymeleaf in provided scope — no concrete Thymeleaf transitive dep ships here. Consumers add the engine matching their deployment:

  • Spring Boot: add org.springframework.boot:spring-boot-starter-thymeleaf — brings in thymeleaf + thymeleaf-spring6 + autoconfigured SpringTemplateEngine. The bridge picks the engine up automatically via BeanStore.getBean(TemplateEngine.class).
  • Juneau microservice / Jetty: add org.thymeleaf:thymeleaf directly. With no user-supplied engine bean, the bridge builds a default TemplateEngine on first request anchored on the importer's classloader.
  • Custom: register your own @Bean TemplateEngine with whatever resolvers, dialects, and template modes you need.

When no Thymeleaf engine is on the classpath, the renderer surfaces a clear diagnostic naming the missing dependency and linking to the "Choosing a TemplateEngine" matrix in ThymeleafViewSupport.md.

See Also:
Since:
10.0.0