Use idea to create a new spring boot project, do nothing, create a new controller, and then start to report an error
Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans . factory.BeanCreationException : Error creating bean with name ‘dataSource’ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$ Hikari.class ]: Bean instantiation via factory method failed; nested exception is org.springframework.beans .BeanInstantiationException: Failed to instantiate [ com.zaxxer.hikari .HikariDataSource]: Factory method ‘dataSource’ threw exception; nested exception is org.springframework.boot . autoconfigure.jdbc.DataSourceProperties $DataSourceBeanCreationException: Failed to determine a suitable driver class
Reason: spring boot will load by default org.springframework.boot . autoconfigure.jdbc.DataSourceAutoConfiguration class
Because there is no configuration information related to datasource in the new spring boot project, an error is reported as soon as it is started
Add the following to the application class:
@EnableAutoConfiguration(exclude={DataSou rceAutoConfiguration.class })
Or configure the datasource information and complete the configuration file
Read More:
- Error creating bean with name ‘sqlsessionfactory’ defined in class path resource
- Error creating bean with name ‘requestMappingHandlerAdapter‘ defined in class path resource
- Error creating bean with name ‘lettuceClientResources‘ defined in class path resource
- Error creating bean with name ‘sqlsessionfactory’ defined in class path resource…..
- Error creating bean with name ‘feignTargeter‘ defined in class path resource [org/springframework/cl
- Error creating bean with name ‘redisTemplate‘ defined in class path resource [xx/RedisConfig.class]
- Error creating bean with name ‘configurationPropertiesBeans‘ defined in class path resource
- Error creating bean with name ‘entitymanagerfactory’ defined in class path resource
- Error creating bean with name ‘sqlsessionfactory’ defined in ServletContext resource)
- Solution to the problem of spring boot running test class error creating bean with name ‘serverendpoint exporter’ defined
- No qualifying bean of type ‘javax.sql.DataSource‘ available: expected at least 1
- Datasource bean injection failed, with startup error
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘use
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
- Error creating bean with name usercontroller appears when springboot starts
- Failed to configure a DataSource
- Error creating bean with name ‘application‘: Instantiation of bean failed;
- An error happened during template parsing (template: “class path resource
- An error is reported when springboot starts: error creating bean with name ‘XXXX’
- Error creating bean with name ‘helloController‘: Injection of autowired dependencies failed;