Module bus.extra

Class TemplateFactory

java.lang.Object
org.miaixz.bus.extra.template.TemplateFactory

public class TemplateFactory extends Object
Simple template engine factory that automatically creates the corresponding template engine object based on the template engine JARs introduced by the user. It uses the Simple Factory pattern.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • TemplateFactory

      public TemplateFactory()
  • Method Details

    • get

      public static TemplateProvider get()
      Retrieves a singleton instance of TemplateProvider based on the available template engine JARs. The first available template engine found via SPI will be used.
      Returns:
      A singleton instance of TemplateProvider.
    • create

      public static TemplateProvider create()
      Creates a new TemplateProvider instance using the default configuration. This method returns a new engine instance each time it is called.
      Returns:
      A new TemplateProvider instance.
    • create

      public static TemplateProvider create(TemplateConfig config)
      Creates a new TemplateProvider instance with the specified configuration. This method returns a new engine instance each time it is called.
      Parameters:
      config - The template configuration, including encoding, template file path, etc.
      Returns:
      A new TemplateProvider instance.