mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-25 21:22:58 +08:00
Revisit TemplateRenderer usage
This commit stops creating a MustacheTemplateRenderer automatically as it is only used by the Spring conventions at the moment. This makes sure that the test infrastructure can be used even if mustache is not available. Closes gh-991
This commit is contained in:
@@ -24,7 +24,9 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Configuration for contributions specific to the help documentation of a project.
|
||||
* Configuration for contributions specific to the help documentation of a project. If no
|
||||
* {@link MustacheTemplateRenderer} exists, a default one on {@code classpath:/templates}
|
||||
* is provided.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@@ -33,9 +35,10 @@ import org.springframework.context.annotation.Import;
|
||||
public class HelpDocumentProjectGenerationConfiguration {
|
||||
|
||||
@Bean
|
||||
public HelpDocument helpDocument(MustacheTemplateRenderer templateRenderer,
|
||||
public HelpDocument helpDocument(ObjectProvider<MustacheTemplateRenderer> templateRenderer,
|
||||
ObjectProvider<HelpDocumentCustomizer> helpDocumentCustomizers) {
|
||||
HelpDocument helpDocument = new HelpDocument(templateRenderer);
|
||||
HelpDocument helpDocument = new HelpDocument(
|
||||
templateRenderer.getIfAvailable(() -> new MustacheTemplateRenderer("classpath:/templates")));
|
||||
helpDocumentCustomizers.orderedStream().forEach((customizer) -> customizer.customize(helpDocument));
|
||||
return helpDocument;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user