當我使用嵌入式 Tomcat(與 IntelliJ)時,我的應用程式作業正常,但是當我在 Tomcat 8 上部署 WAR 檔案時,我的 URL 之一回應為 404(我可以登錄到我的應用程式,但注銷時 URL 回應為 404)。當我將 IntelliJ 與 Tomcat 一起使用時,不會發生此問題。
我的 POM 檔案:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
組態檔:
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable();
http
.headers()
.frameOptions().disable();
http
.authorizeRequests()
.anyRequest().permitAll();
}
更新
我換成Tomcat 9 還是有問題。
更新_2
我有 JSF 視圖
uj5u.com熱心網友回復:
我發現 tomcat 在沒有頁面的情況下存在 api 問題,然后我創建了一個按鈕并呼叫了該方法:
public void logout(){
userAuthService.logout();
FacesContext.getCurrentInstance().getExternalContext()
.invalidateSession();
FacesContext.getCurrentInstance().getExternalContext()
.redirect("login.xhtml?faces-redirect=true");
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/537017.html
標籤:爪哇弹簧靴雄猫弹簧安全
