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
- Installation failed with message INSTALL_FAILED_USER_RESTRICTED錯誤AIREST
- fatal: Authentication failedAI
- Gradle sync failed: Cause: dl.google.com:443 failed to respondGradleAIGo
- Android resource linking failedAndroidAI
- SDK Manager:failed to installAI
- Gradle Project Sync FailedGradleProjectAI
- Generating Pods project failedProjectAI
- NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load xxxx錯誤解決方法ErrorAIXMLHTTP
- jupyter-kernelRestart:restart failedRESTAI
- Execution failed for task ':app:compileDebugJavaWithJavac'AIAPPCompileJava
- fork failed - Cannot allocate memoryAI
- OPatch failed with error code 73AIError
- Execution failed for task ‘:demo:stripReleaseDebugSymbols‘.AISymbol
- app:processReleaseResources, Failed to execute aaptAPPAIAPT
- 解決:Failed to load ApplicationContextAIAPPContext
- Spark Streaming Failed to read checSparkAI
- Execution failed for task ‘:app:processDebugResources‘.AIAPP
- ascp: Failed to open TCP connection for SSH, exiting. Session Stop (Error: Failed to open TCP connection for SSH)AITCPSessionError
- cadvisor報錯failed to collect filesystem stats- rootDiskErr: du command failed on /rootfs/var/lib/docAI
- 安裝失敗(Installing failed)AI
- Arch更新時failed to prepare transactionAI
- 【ERROR】OPatch failed with error code 73ErrorAI
- zabbix報錯fping failed:no outputAI
- Nginx: stat() failed (13: permission denied)NginxAI
- preg_match_all (): Compilation failed:AI
- SourceTree 提示 fatal: Authentication failed for..AI
- OGG Director報錯 Connection FAILEDAI
- gpg: signing failed: Inappropriate ioctl for deviceAIAPPdev
- TypeError: Failed to fetch dynamically imported moduleErrorAIImport
- 上傳報錯:Upload Failed: Your upload has failed a virus scan. Please choose another file.AI
- PHP composer 報錯 certificate verify failedPHPAI
- 【AndroidStudio】Error:Execution failed for task ':app:preDebugAndroidTestBuild'.AndroidErrorAIAPPUI
- sudo apt-get update | grep "Failed"apt-getAI
- logstash retrying failed action with response code: 429AI
- IDEA 報錯Failed to load JVM DLLIdeaAIJVM
- SQLServer映象報錯Connection handshake failedSQLServerAI