allegro / handlebars-spring-boot-starter

Spring Boot auto-configuration for Handlebars
Apache License 2.0
109 stars 27 forks source link

support spring boot 3 #46

Closed detectivevivacious closed 3 weeks ago

galmegiz commented 1 year 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 1 year 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 1 year 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 1 year 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 5 months ago

I think handlebars-springmvc now supports SpringBoot 3

3750 commented 3 weeks ago

Version 0.5.0 was released 🎉 and artifact is available in Maven Central. Please remember the new version requires Spring Boot 3, Spring Framework 6 and Java 17 (and Gradle 7.3).

@jcputney thank you for your contribution 🙏