Issue
I have changed the spring boot version of my web application from 2.1.2 to 2.6.6 . Here is the POM---
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath>/</relativePath> <!-- lookup parent from repository -->
</parent>
A1fter version upgrade I faced some circular dependency issues which I resolved using constructor injection with @Lazy annotation. Below is example---
@Autowired
public ServiceImpl(@Lazy ABCService abcService,
@Lazy XYZService xyzService,
@Lazy PQRMapper pqrMapper,
@Lazy PQRService pqrRepositoryService) {
super();
this.abcService = abcService;
this.xyzService = xyzService;
this.pqrMapper = pqrMapper;
this.pqrRepositoryService = pqrRepositoryService;
}
But if I am trying to hiit any API it is giving me 404.
Can anyone suggest what I can do to resolve this.
Solution
I found the issue after going through all the release documents, I figured out that spring-boot disables the default-dispatcher-servlet. so we need to enable it with property-
server.servlet.register-default-servlet=true
This solution worked for me.
Answered By - Rishabh Sharma
Answer Checked By - Katrina (JavaFixing Volunteer)