allegro / handlebars-spring-boot-starter

Spring Boot auto-configuration for Handlebars
Apache License 2.0
108 stars 26 forks source link

support spring boot 3 #46

Open detectivevivacious opened 1 year ago

galmegiz commented 11 months ago

Does the current version of Handlebars not support Spring boot 3.x? I tried adding Handlebars to my Spring Boot 3.x project but encountered an error. I manually registered the bean, but it also did not work.

    @Bean
    public HandlebarsViewResolver handlebarsViewResolver(){
        HandlebarsViewResolver viewResolver = new HandlebarsViewResolver();
        viewResolver.setOrder(1);
        viewResolver.setPrefix("classpath:templates/");
        viewResolver.setSuffix(".hbs");
        return viewResolver;
    }
galmegiz commented 11 months ago

When I use Spring Boot 3.x with the same configuration as in Boot 2.x, an error is occurs(the file "error.hbs" exists in /resources/templates/error.hbs)

java.io.FileNotFoundException: classpath:templates/templates/error.hbs
    at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70) ~[handlebars-4.2.0.jar:na]
    at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:438) ~[handlebars-4.2.0.jar:na]
    at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:419) ~[handlebars-4.2.0.jar:na]
    at com.github.jknack.handlebars.springmvc.HandlebarsViewResolver.configure(HandlebarsViewResolver.java:199) ~[handlebars-springmvc-4.2.0.jar:na]
    at com.github.jknack.handlebars.springmvc.HandlebarsViewResolver.buildView(HandlebarsViewResolver.java:181) ~[handlebars-springmvc-4.2.0.jar:na]
(...)
KKolej commented 10 months ago

@galmegiz handlebars-spring-boot-starter do not support spring 3.x. We aren't actively develop this project, but We are open for pr that will provide support for spring 3.x.

3750 commented 8 months ago

Seems that handlebars (handlebars-springmvc) does not support Spring Boot 3 https://github.com/jknack/handlebars.java/issues/1064. This starter uses handlebars-springmvc. We have to wait for Spring Boot 3 support in handlebars-springmvc.

nodarsan commented 1 month ago

I think handlebars-springmvc now supports SpringBoot 3