Autowire freemarker is not working with junit test in spring boot

Viewed 182

I have added freemarker template inside spring boot. I did autowiring as follows:

@Autowired
private Configuration freemarkerConfig;

After auto wiring, my server is working fine but when I am trying to execute any test case, it fails with error

Unsatisfied dependency expressed through field 'freemarkerConfig'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'freemarker.template.Configuration' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

I tried adding @SpringBootTest but it's not working.

0 Answers
Related