1. 程式人生 > >Spring-boot 啟動時碰到的錯誤

Spring-boot 啟動時碰到的錯誤

spring boot 啟動時報如下錯誤:

Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
* WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2016-02-26 10:07:01.550  WARN 6112 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.BeanDefinitionStoreException:
Failed to read candidate component class: URL [jar:file:/C:/Users/cmc/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.RELEASE/spring-boot-autoconfigure-1.2.5.RELEASE.jar!/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$JdbcTemplateConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration due to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:303) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248) at org.springframework
.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:140) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:230) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:166) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) ...

原因:application.java 檔案不能直接放在main/java資料夾下,必須要建一個包把他放進去

解決方案:把src/java 路徑下的.java檔案放到建的包下

相關推薦

Spring-boot 啟動碰到的錯誤

spring boot 啟動時報如下錯誤: Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package * WARNING ** :

spring boot啟動異常(Unable to start embedded Tomcat servlet container)

org.springframework.boot.context.embedded.EmbeddedServletContainerException: **Unable to start embedded Tomcat servlet container** at org.sprin

Spring Boot 啟動出現 requestMappingHandlerAdapter 錯誤

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class pat

Spring Boot啟動動態切換每個環境的配置檔案

  開發專案一般是開發環境,測試環境,和生產環境,例如:Spring Boot的application.properties配置如下   application-dev1.priperties相當於開發環境,以此類推,當你啟動Spring Boot時,切換每個環

spring boot啟動載入系統資料的方法

有時候我們需要在應用啟動或者重啟後做一些工作,比如刪除一些臨時檔案或者Redis中的快取,這在沒有使用Spring Boot之前,在Spring框架下是通過ApplicationListener監聽器來實現的,在Spring Boot下也有一些辦法,可以通過使用CommandLineRunner和A

spring boot 啟動執行程式碼(2)ApplicationListener

專案概覽:   StepExecutor: @Component @Slf4j public class StepExecutor implements Runnable { @Autowired private HelloService helloService;

CommandLineRunner、EnvironmentAware在Spring boot啟動執行初始化程式碼

@Component //如果有多個這樣的類時,可以通過Order指定執行順序,數值越小執行優先順序越高 @Order(value = 0) public class InitSystemConfig implements CommandLineRunner ,Environ

spring boot 啟動關於The APR based Apache Tomcat Native library的問題

在Windows中除錯spring boot 2 應用時日誌中出現下面資訊: [2018-08-04 16:19:29,335][INFO] [localhost-startStop-1] Caller+0 at org.apache.juli.logging.Direc

Eclipse 搭建Spring boot 啟動報日誌衝突錯誤

             最近學習使用Spring boot 搭建專案,發現啟動的時候有紅色的錯誤提示,雖然沒有什麼影響,但是看著不舒服。問題如下圖:  發現是logback和slf4j包下面StaticLoggerBinder.class檔案衝突錯誤。那麼應該去掉

spring boot啟動未報錯,但是http請求無法連線

新建了一個控制器,並嘗試進行啟動請求,卻提示無連線: @RestController public class DemoController { @RequestMapping("/hello") public String index() {

Spring boot 啟動錯誤處理

今天準備把我之前搭建的,基於springboot的框架的基礎功能包抽離出來,在增加spring yml自定義設定後,在業務專案啟動時會報出以下異常。 2017-02-23 18:55:09.869 WARN main org.springframewor

spring-boot啟動錯誤

錯誤分析 參考了下其它正確的Spring Boot專案,發現是這行配置及程式碼出錯了 <dependency>             <groupId>org.springframework.

spring boot 啟動常見錯誤記錄

1.錯誤: Description: Failed to configure a DataSource: 'url' at

Spring boot 啟動報錯:com.mongodb.MongoSocketOpenException: Exception opening socket

clas cati helper res connect ava bstr efault def   詳細錯誤信息: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.

修改spring boot 啟動logo

pri 9.png spring .cn 需要 cnblogs images ima 技術分享 修改spring boot 啟動logo 在項目添加文件banner.txt,將需要的logo寫在裏面 效果: 修改spring boot 啟動logo

Spring Boot 啟動報錯:LoggingFailureAnalysisReporter

char build starting zed load ring base resource enc 17:57:19: Executing task ‘bootRun‘... Parallel execution with configuration on dem

spring boot 啟動報錯:Cannot determine embedded database driver class for database type NONE

info for bubuko 報錯 spring free 增加 .com control 錯誤原因:spring boot默認會加載org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurati

Spring Boot 啟動報錯 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37

work 結果 frame getc director inf 中文 getclass post 使用命令 java -jar springBoot.jar 啟動項目,結果報錯如下: Exception in thread "main" java.lang.String

spring boot 啟動類 添加組件

urn back members size RR highlight class sleep ndk @SpringBootApplication @EnableEurekaClient @EnableCircuitBreaker @ServletComponentSca

spring-boot 啟動時候 出現異常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

ng- for sed AC 存在 cti 解決方法 sid 失敗 The bean ‘xxxService‘ could not be injected as a ‘AaaXxxService‘ because it is a JDK dynamic proxy tha