Skip to content
Advertisement

FreeMarker configuration conflict (Spring Boot)

I have a FreeMarker configuration:

JavaScript

And dependencies from build.gradle:

JavaScript

It works okay. But when I set following dependency in build.gradle:

implementation 'org.springframework.boot:spring-boot-starter-data-rest'

I’ll get an error:

JavaScript

Seems like spring-data-rest provides configured FreeMarker too and conflict happens. @Primary and @Qualifier don’t work. What can I do?

[UPDATE]

Tried to add exclude to my main class:

JavaScript

Now application can start, but FreeMarker doesn’t work.

Advertisement

Answer

Found solutions:

  1. Set in properties (beans names should be the same): spring.main.allow-bean-definition-overriding=true

  2. Delete FreeMarker custom config and use default one. Set in properties: spring.freemarker.template-loader-path

And use

JavaScript

Instead of spring-data-rest and org.freemarker:freemarker

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement