mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +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;
|
||||
}
|
||||
|
@@ -30,12 +30,6 @@
|
||||
<artifactId>assertj-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.samskivert</groupId>
|
||||
<artifactId>jmustache</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
|
@@ -24,7 +24,6 @@ import java.util.function.Supplier;
|
||||
|
||||
import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.io.SimpleIndentStrategy;
|
||||
import io.spring.initializr.generator.io.template.MustacheTemplateRenderer;
|
||||
import io.spring.initializr.generator.project.DefaultProjectAssetGenerator;
|
||||
import io.spring.initializr.generator.project.MutableProjectDescription;
|
||||
import io.spring.initializr.generator.project.ProjectAssetGenerator;
|
||||
@@ -51,7 +50,6 @@ public class ProjectGeneratorTester extends AbstractProjectGenerationTester<Proj
|
||||
private static Map<Class<?>, Supplier<?>> defaultBeans() {
|
||||
Map<Class<?>, Supplier<?>> beans = new HashMap<>();
|
||||
beans.put(IndentingWriterFactory.class, () -> IndentingWriterFactory.create(new SimpleIndentStrategy(" ")));
|
||||
beans.put(MustacheTemplateRenderer.class, () -> new MustacheTemplateRenderer("classpath:/templates"));
|
||||
return beans;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user