Error log:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.zxycloud.common.MybatisGeneratorApplication]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/redisConfig.properties]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 25 common frames omitted
Idea has this error in install and package. Its configuration file and startup class are all written correctly. But why can’t I find the configuration?
The reason is this: the core message of the error is that a properties file cannot be found
The classpath is not added when the configuration file path is written in the code. Normal code should look like this:
If classpath is not added, an error will be reported, resulting in the failure of install
Similar Posts:
- Springboot: solve the problem of failed to load ApplicationContext
- [Solved] Java.lang.ClassNotFoundException: javax.xml.bind.JAXBException (i)
- [Solved] java.sql.SQLException: Access denied for user ”@’localhost’ (using password: NO)
- [Solved] No qualifying bean of type ‘org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder’ available:
- Springboot starts with @ scheduled and reports an error: no qualifying bean
- SpringBoot Datas Validation Build Error: Add a provider like Hibernate Validator (RI) to your classpath
- [Solved] Caused by: java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory
- [Solved] Spring Boot Use Spring Data Redis Error: org.springframework.beans.factory.BeanCreationException
- Error reported by feign component of springcloud microservice
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field