java:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Failed to determine a suitable driver class

***************************

APPLICATION FAILED TO START

***************************

 

Description:

 

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

 

Reason: Failed to determine a suitable driver class

 

 

Action:

 

Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

 

 

Solution:

1 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

   If a plurality of: modified @SpringBootApplication (exclude = {MongoAutoConfiguration.class, DataSourceAutoConfiguration.class})

2 Appeals modification does not take effect: possible reason is that idea does not specify resource directories, did not lead to the configuration file when you start reading

   Methods: Right-click the resource folder -> MarkDirectory as -> Sources Root

Both methods have been tried, the second method successfully solve the problem

  

Guess you like

Origin www.cnblogs.com/singlelcx/p/11528570.html