In the Spring boot project, we added MySQL and mybatis dependencies to the Pom.xml file, and we often encountered the following problem:
class for from a particular profiles need to active it (no profiles is currently active).
This problem occurs because spring boot injects the data source when the project is started, and we do not configure the database in the configuration file, so we will report such errors.
Workaround:
1. Of course, directly comment out the pom.xml file of the MySQL and MyBatis dependencies, so spring boot boot time of course will not inject data source, so there will be no error.
2. Exclude the injection in the @springbootapplication
@SpringBootApplication (exclude={datasourceautoconfiguration. Class, Hibernatejpaautoconfiguration. class})
3. Configure the database connection directly in the configuration file well, how simple things, that of course, will not be an error.
Spring.datasource.driverclassname=com.mysql.jdbc.Driverspring.datasource.url=jdbc:mysql:// localhost:3306/testspring.datasource.username=rootspring.datasource.password=root
Spring boot appears cannot determine embedded database driver class for database type NONE