How to Solve JAR pack error: Error resolving template [/userInfo], template might not exist or might not be accessib

This error did not appear when I was running in idea, but it appeared after I typed the project into a jar package and executed the jar package. This error means that the template page cannot be found, but the template page actually exists in my project. The solution to this error is to skip the template page in the controller without starting with “/”.

Example

@Controller
public class userController {

    @Autowired
    private userServiceImpl userService;

    @RequestMapping("/userInfo/{nickname}")
    public Object showBlog(@PathVariable("nickname") String nickname,
                           Model model, HttpServletRequest request){

        User userInfo = userService.getUserInfo(nickname);
        model.addAttribute("userInfo",userInfo);
        return "userInfo";
    }
}

Read More: