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

搭建全新架构的时候,引入包就会引发这个问题,因为这个时候没有配置数据库呢,但是默认是需要的
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.5.RELEASE)
2023-11-03 02:30:34.087 INFO 20144 --- [ main] further.MainApp : Starting MainApp on thinkpad-t440p-zwf with PID 20144 (D:\eclipse-jee-oxygen-2-win32-x86_64\workspace\test\target\classes started by Administrator in D:\eclipse-jee-oxygen-2-win32-x86_64\workspace\test)
2023-11-03 02:30:34.090 INFO 20144 --- [ main] further.MainApp : The following profiles are active: dev
2023-11-03 02:30:34.643 INFO 20144 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2023-11-03 02:30:34.661 INFO 20144 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8ms. Found 0 repository interfaces.
2023-11-03 02:30:35.323 INFO 20144 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1d286883] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-11-03 02:30:36.118 INFO 20144 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8072 (http)
2023-11-03 02:30:36.150 INFO 20144 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-11-03 02:30:36.151 INFO 20144 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
2023-11-03 02:30:36.308 INFO 20144 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-11-03 02:30:36.309 INFO 20144 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2163 ms
2023-11-03 02:30:36.381 WARN 20144 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2023-11-03 02:30:36.385 INFO 20144 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-11-03 02:30:36.397 INFO 20144 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-03 02:30:36.400 ERROR 20144 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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).
先把这些没用的先移除

相应的也移除掉


在尝试启动一个基于SpringBoot2.1.5的应用时,由于未配置数据源URL,报错提示无法自动配置。开发者需要确保已提供数据库连接设置或配置嵌入式数据库。
24万+

被折叠的 条评论
为什么被折叠?



