Failed to introspect annotated ** org.springframework.boot.web.support.SpringBootServletInitializer
Failed to introspect annotated ** org.springframework.boot.web.support.SpringBootServletInitializer
Spring Boot
應用啟動類:
@SpringBootApplication
public class ApiApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
return applicationBuilder.sources(ApiApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(ApiApplication.class, args);
}
}
- 解決方案一,修改
pom.xml
,將tomcat
的scope
修改為compile
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>compile</scope>
<!--<scope>provided</scope>-->
</dependency>
- 解決方案二,使用命令列啟動程式,但是這種啟動方式就不能斷點除錯了:
spring-boot:run
原因:這個可能時IDEA的一個BUG或者是沒有設定好classpath
,程式在啟動時找不到servlet context
,打包成war
時放到tomcat
容器裡面去執行時war
包會使用tomcat
的servlet context
;在本地除錯時,如果scope
是provided
的話,由於IDEA
沒有設定好classpath
,然後也沒有用tomcat
的依賴,所以就找不到servlet context
,因而報錯。由此就產生了如上兩種可選的解決方案!
相關文章
- 異常解決——Failed to introspect Class [com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration]AIROSGithub
- PHP Annotated——2024 年 1 月PHP
- fatal: Authentication failedAI
- Authentication failed!nullAINull
- MediaRecorder start failed -19 java.lang.RuntimeException: start failedAIJavaException
- Gradle sync failed: Cause: dl.google.com:443 failed to respondGradleAIGo
- Injection of autowired dependencies failed;AI
- request gap sequence is FailedAI
- [ERROR] Failed to open logErrorAI
- Prerequisite check "CheckActiveFilesAndExecutables" failedUIAI
- how to clean failed crsAI
- Installation failed with message INSTALL_FAILED_USER_RESTRICTED錯誤AIREST
- fork failed - Cannot allocate memoryAI
- SDK Manager:failed to installAI
- Generating Pods project failedProjectAI
- Gradle Project Sync FailedGradleProjectAI
- OPatch failed with error code 73AIError
- app:processReleaseResources, Failed to execute aaptAPPAIAPT
- 【kylin】Failed to build cubeAIUI
- linker command failedAI
- Failed to create or upgrade OLRAI
- SqlCommand.DeriveParameters failedSQLAI
- adoacorectl.sh FailedAI
- FAILED_LOGIN_ATTEMPTSAI
- GUI quick cut and paste failedGUIASTAI
- Starting HAL daemon:[FAILED]AI
- RAC User Equivalence Check FailedUIAI
- SSH Host key verification failedAI
- 【ERROR】OPatch failed with error code 73ErrorAI
- jupyter-kernelRestart:restart failedRESTAI
- SourceTree 提示 fatal: Authentication failed for..AI
- Execution failed for task ‘:demo:stripReleaseDebugSymbols‘.AISymbol
- Execution failed for task ‘:app:processDebugResources‘.AIAPP
- Arch更新時failed to prepare transactionAI
- [VRDevice] Initialization of device oculus failed.VRdevAI
- idapython import 'site' failedPythonImportAI
- pyenv BUILD FAILED解決方法UIAI
- open failed: EBUSY (Device or resource busy)AIdev