allegro / handlebars-spring-boot-starter

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

Fix circular reference between beans #42

Closed aderigs closed 2 years ago

aderigs commented 2 years ago

Hi,

starting with spring-boot 2.6 circular references are prohibited by default. See: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.6-Release-Notes#circular-references-prohibited-by-default

Our application didn't start with the following message:

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

┌──->──┐
|  pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsAutoConfiguration$HandlebarsCacheConfiguration (field private com.github.jknack.handlebars.cache.TemplateCache pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsAutoConfiguration$HandlebarsCacheConfiguration.templateCacheInstance)
└──<-──┘

Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

This pull request fixes this.

3750 commented 2 years ago

Hi @aderigs. Thank you for this fix! I will look into this closer next week and then a new version will be released.

3750 commented 2 years ago

Version 0.3.4 was released and is available in Maven Central.