尝试通过
http://localhost:8080/index测试我部署的
Springboot
应用程序,它总是会将我重定向到 http://localhost:8080/login,我现在不知道它是什么.
我的应用程序成功启动,没有任何错误,控制器类如下:
package com.spirosvatikiotis.fleetapp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class ApplicationController {
@GetMapping("/index")
public String goHome() {
return "index";
}
}
这与cookies有关吗?
您已启用 Spring 安全性。您被重定向到 /login,因为您没有访问 /index 的权限。
完全禁用安全性或在 /login 上启用未经身份验证的请求。