JAVA_HOME 與 Pathsrc/main/java、src/main/resources、src/main/webapp/WEB-INF/web.xml| 層面 | 配置 | 效果 |
|---|---|---|
| 靜態資源 (HTML/JS/CSS) | Deployment → Update resources on frame deactivation | 編輯器失焦即同步到 exploded 目錄,瀏覽器刷新生效 |
| Java 類/配置 | Run → Edit Configurations → On 'Update' action: Update classes and resources | Ctrl+F10 觸發熱插拌,無需重啟 |
| Spring Boot 專項 | 依賴 spring-boot-devtools + IDEA Registry `compiler.automake.allow.when.app.running` | 類文件修改自動編譯 + 重啟應用上下文 |
| 現象 | 原因 | 解決 |
|---|---|---|
| 404 Not Found | Application context 不匹配、部署路徑錯誤 | 檢查 Deployment → Application context、web.xml ` |
| ClassNotFound: javax.servlet.* | Tomcat 10+ 遷移至 jakarta.servlet.* | 依賴 `jakarta.servlet-api`、代碼改 `import jakarta.servlet.*` |
| 端口衝突 | 8080 被佔用 | 修改 Server → HTTP port、或 `netstat -ano | findstr 8080` 殺進程 |
| 中文亂碼 | 編碼未統一 | VM options `-Dfile.encoding=UTF-8`、Tomcat `URIEncoding="UTF-8"`、DB 連接 `characterEncoding=utf8` |
| 熱部署不生效 | 未選 exploded artifact、未勾選 Update 選項 | 重新配置 Deployment、確認 `compiler.automake.allow.when.app.running` |