Class MjmlService
java.lang.Object
dev.jcputney.mjml.spring.MjmlService
Spring-managed service for rendering MJML templates to HTML.
This is a thin facade over a reusable MjmlRenderer instance created from the injected
MjmlConfiguration.
-
Constructor Summary
ConstructorsConstructorDescriptionMjmlService(dev.jcputney.mjml.MjmlConfiguration configuration) Creates a service bound to the provided renderer configuration. -
Method Summary
Modifier and TypeMethodDescriptiondev.jcputney.mjml.MjmlConfigurationReturns the configuration used by this service.Renders an MJML template to HTML.dev.jcputney.mjml.MjmlRenderResultrenderResult(String mjml) Renders an MJML template and returns the full result including metadata.
-
Constructor Details
-
MjmlService
public MjmlService(dev.jcputney.mjml.MjmlConfiguration configuration) Creates a service bound to the provided renderer configuration.- Parameters:
configuration- immutable renderer configuration
-
-
Method Details
-
render
-
renderResult
Renders an MJML template and returns the full result including metadata.- Parameters:
mjml- the MJML source string- Returns:
- the render result containing HTML, title, and preview text
-
getConfiguration
public dev.jcputney.mjml.MjmlConfiguration getConfiguration()Returns the configuration used by this service.- Returns:
- active renderer configuration
-