Using keycloak and spring boot, after successful authentication GET request is forwarded to /static/index.html file instead of the RestController method below. System.out.println in the below method also not getting executed. This issue happened after migrating from jdk1.8 to jdk 21 and after upgrading spring boot to 3.1.4 how to fix this issue.
@RestController
@RequestMapping(("/api/user"))
@Slf4j
public class UserController {
@Autowired
private UserService userService;
@GetMapping("me")
public ResponseEntity<?> me(Principal principal) {
System.out.println("***************************************************************");
if (principal == null) {
return ControllerUtil.getUnauthorizedResponse();
}
return userService.getUserDetails(new IAppsUser(principal));
}
}
I am expecting it should print the println statement in the method me(Principal principal) and execute the code properly
After upgrading to latest jdk 21 and spring boot 3.1.4 I found that it is not scanning the base package as before. So I added the package in the main class and the issue got resolved