Rishabh Sharma
Rishabh Sharma

Reputation: 123

Spring Boot Application giving 404 after upgrading to springboot 2.6.6

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;
}

enter image description here

But if I am trying to hiit any API it is giving me 404. enter image description here

Can anyone suggest what I can do to resolve this.

Upvotes: 0

Views: 2089

Answers (2)

Rishabh Sharma
Rishabh Sharma

Reputation: 123

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.

Upvotes: 3

lukwas
lukwas

Reputation: 227

in log there is info exposing one endpoint beneath base path '/internal'

maybe those controllers you try to use are not created maybe package is not scaned

Upvotes: 0

Related Questions