Spring boot appears cannot determine embedded database driver class for database type NONE

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.