Spring boot 如何在没有控制器的情况下使用thymeleaf

Spring boot 如何在没有控制器的情况下使用thymeleaf,spring-boot,thymeleaf,Spring Boot,Thymeleaf,我想在我的spring boot应用程序中使用thymeleaf模板。我在src/resources/public目录中有一些html页面,我希望在不编写控制器的情况下提供它们,因为我想编写前端应用程序。我可以在http://localhost:8080/index.html但它没有使用thymeleaf语法。我怎么做 我添加了thymeleaf依赖项,尝试编写SpringResourceTemplateResolverbean,但仍然没有成功。以下是我迄今为止所做的工作: @SpringBoo

我想在我的spring boot应用程序中使用thymeleaf模板。我在
src/resources/public
目录中有一些html页面,我希望在不编写控制器的情况下提供它们,因为我想编写前端应用程序。我可以在
http://localhost:8080/index.html
但它没有使用thymeleaf语法。我怎么做

我添加了thymeleaf依赖项,尝试编写
SpringResourceTemplateResolver
bean,但仍然没有成功。以下是我迄今为止所做的工作:

@SpringBootApplication
public class MyApplication {

    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }

    @Bean
    public SpringResourceTemplateResolver templateResolver(){
        SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
        templateResolver.setPrefix("classpath:/public/");
        templateResolver.setSuffix(".html");
        templateResolver.setTemplateMode(TemplateMode.HTML);
        templateResolver.setCacheable(true);
        return templateResolver;
    }
}

那么您想预生成html,然后将其放在Web服务器可以访问的目录中?是的,类似这样的。我有一个
base.html
和一些
child.html
。我想使用thymeleaf来实现这一点,使用VueJS来实现api调用。我不需要spring控制器。请参见: