Use springboot to connect to the database, an error is reported when starting: testWhileIdle is true, validationQuery not set. But it does not affect the use of the system, and all access to the database is normal.
The application.properties data source configuration is as follows:
springboot1.4 cancel spring.datasource.type
In the new version, the validationQuery is not automatically injected, so you need to manually declare the datasource bean. As for how to write, you can read the above article.
It is mainly to manually inject DruidDataSource, declare a configuration class, inject all values of the data source into it, and return to DruidDataSource.
Restart, the system does not report an error!
Finally, I checked the DruidDataSource source code,
public static final String DEFAULT_VALIDATION_QUERY = null;
Sure enough, the DruidDataSource default testWhileIdle=true, and the validationQuery is set to empty.
- SpringBoot startup error Failed to determine a suitable driver class
- [Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource
- [How to Fix] Spring boot startup error: could not resolve placeholder
- [Solved] Springboot Startup Error: Consider defining a bean of type ‘XXX’ in your configuration.
- Error starting ApplicationContext. To display the auto-configuration report re-run your application
- [Solved] Error getting bean using springboot: no qualifying bean of type ‘xxx’ available
- Error creating bean with name ‘redistemplate’ defined in class path resource
- Spring Boot Druid Error: discard long time none received connection
- Error reported when springboot connects to redis nested exception is redis.clients.jedis . exceptions.JedisConnectionException
- Dyf Spring boot startup error: NoSuchBeanDefinitionException
- [Solved] There are test failures. Please refer to D:\Java_study\springboot\springboot-sugon-3\target\surefire-reports for the individual test results.
- When integrating redis with SSM framework, error creating bean with name ‘rediscontentserviceimpl’ defined in file
- [neo4j] error report when visiting neo4j in spring boot project
- [Solved] com.alibaba.druid.pool.DruidDataSource – create connecti
- A mistake about implicitly providing default constructors
- How to Solve Error: Cannot find the declaration of element ‘beans’.
- How to Solve Error creating bean with name ‘log’loginController’
- SpringCloud: gateway module startup error [How to Solve]
- [How to Solve] java.lang.IllegalArgumentException: Request header is too large
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for