Spring boot data source is not configured with an exception

Source: Internet
Author: User
problem

When you select a data source for a project framework that is automatically generated by springboot, such as by selecting MySQL, the startup will report an exception after the project is built:

Description:

cannot determine embedded database driver class for database type NONE

Action:

If your want an EMB edded database Please put a supported one on the classpath. If you are have database settings to is loaded from a particular profiles you'll need to active it (no profiles are currently Active).
Problem Analysis

This problem occurs because a springboot-generated project is automatically injected into the data source when it is started. When the data source information is not configured in the configuration file, an exception is thrown. Solution

(1) If you do not need a data source for the time being, you can comment out the MySQL and MyBatis (or other data source framework) in the Pom file to start normally.
(2) excluding its injection in @springbootapplication

@SpringBootApplication (Exclude={datasourceautoconfiguration.class,hibernatejpaautoconfiguration.class})

(3) Provide the configuration of the data source or other data source configuration, here provide the default configuration example, add the following configuration items in the Application.properties file:

# the primary data source, the default #spring. Datasource.type=com.zaxxer.hikari.hikaridatasource
Spring.datasource.driverclassname=com.mysql.jdbc.driver Spring.datasource.url=jdbc:mysql://localhost:3306/test Spring.datasource.username=root Spring.datasource.password=root 

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.