请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

mysql url报错?

pom:

application -dev:

server:
port: 8081
servlet:
context-path: /luckymoney

limit:
minMoney: 0.01
maxMoney: 9999
description: 最少要发KaTeX parse error: Expected 'EOF', got '元' at position 17: …limit.minMoney}元̲,最多{limit.maxMoney}
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/luckymoney
username: root
password:
jpa:
hibernate:
ddl-auto: create
show-sql: true


运行:


2019-04-22 22:31:30.775 INFO 18852 — [ main] c.i.luckymoney.LuckymoneyApplication : Starting LuckymoneyApplication on LAPTOP-MEFJUFMM with PID 18852 (C:\Users\yzj96_izo1ngm\IdeaProjects\luckymoney\target\classes started by yzj96_izo1ngm in C:\Users\yzj96_izo1ngm\IdeaProjects\luckymoney)
2019-04-22 22:31:30.777 INFO 18852 — [ main] c.i.luckymoney.LuckymoneyApplication : The following profiles are active: prod
2019-04-22 22:31:31.589 INFO 18852 — [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-04-22 22:31:31.607 INFO 18852 — [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11ms. Found 0 repository interfaces.
2019-04-22 22:31:31.884 INFO 18852 — [ main] trationDelegateBeanPostProcessorChecker:Bean′org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration′oftype[org.springframework.transaction.annotation.ProxyTransactionManagementConfigurationBeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfigurationBeanPostProcessorChecker:Beanorg.springframework.transaction.annotation.ProxyTransactionManagementConfigurationoftype[org.springframework.transaction.annotation.ProxyTransactionManagementConfigurationEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIB479a82c8]isnoteligibleforgettingprocessedbyallBeanPostProcessors(forexample:noteligibleforauto−proxying)2019−04−2222:31:32.159INFO18852−−−[main]o.s.b.w.embedded.tomcat.TomcatWebServer:Tomcatinitializedwithport(s):8081(http)2019−04−2222:31:32.180INFO18852−−−[main]o.apache.catalina.core.StandardService:Startingservice[Tomcat]2019−04−2222:31:32.180INFO18852−−−[main]org.apache.catalina.core.StandardEngine:StartingServletengine:[ApacheTomcat/9.0.17]2019−04−2222:31:32.300INFO18852−−−[main]o.a.c.c.C.[.[localhost].[/luckymoney]:InitializingSpringembeddedWebApplicationContext2019−04−2222:31:32.300INFO18852−−−[main]o.s.web.context.ContextLoader:RootWebApplicationContext:initializationcompletedin1476ms2019−04−2222:31:32.818INFO18852−−−[main]o.s.s.concurrent.ThreadPoolTaskExecutor:InitializingExecutorService′applicationTaskExecutor′2019−04−2222:31:32.954WARN18852−−−[main]ConfigServletWebServerApplicationContext:Exceptionencounteredduringcontextinitialization−cancellingrefreshattempt:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname′dataSource′definedinclasspathresource[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration479a82c8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-04-22 22:31:32.159 INFO 18852 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http) 2019-04-22 22:31:32.180 INFO 18852 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2019-04-22 22:31:32.180 INFO 18852 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17] 2019-04-22 22:31:32.300 INFO 18852 --- [ main] o.a.c.c.C.[.[localhost].[/luckymoney] : Initializing Spring embedded WebApplicationContext 2019-04-22 22:31:32.300 INFO 18852 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1476 ms 2019-04-22 22:31:32.818 INFO 18852 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2019-04-22 22:31:32.954 WARN 18852 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration479a82c8]isnoteligibleforgettingprocessedbyallBeanPostProcessors(forexample:noteligibleforautoproxying)2019042222:31:32.159INFO18852[main]o.s.b.w.embedded.tomcat.TomcatWebServer:Tomcatinitializedwithport(s):8081(http)2019042222:31:32.180INFO18852[main]o.apache.catalina.core.StandardService:Startingservice[Tomcat]2019042222:31:32.180INFO18852[main]org.apache.catalina.core.StandardEngine:StartingServletengine:[ApacheTomcat/9.0.17]2019042222:31:32.300INFO18852[main]o.a.c.c.C.[.[localhost].[/luckymoney]:InitializingSpringembeddedWebApplicationContext2019042222:31:32.300INFO18852[main]o.s.web.context.ContextLoader:RootWebApplicationContext:initializationcompletedin1476ms2019042222:31:32.818INFO18852[main]o.s.s.concurrent.ThreadPoolTaskExecutor:InitializingExecutorServiceapplicationTaskExecutor2019042222:31:32.954WARN18852[main]ConfigServletWebServerApplicationContext:Exceptionencounteredduringcontextinitializationcancellingrefreshattempt:org.springframework.beans.factory.BeanCreationException:ErrorcreatingbeanwithnamedataSourcedefinedinclasspathresource[org/springframework/boot/autoconfigure/jdbc/DataSourceConfigurationHikari.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
2019-04-22 22:31:32.955 INFO 18852 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor’
2019-04-22 22:31:32.958 INFO 18852 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-04-22 22:31:33.012 INFO 18852 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2019-04-22 22:31:33.026 ERROR 18852 — [ 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).

Process finished with exit code 1

正在回答 回答被采纳积分+3

3回答

追寻0218 2019-06-19 10:16:47

我也是这个问题,

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

怎么解决,老师给解答一下呗

0 回复 有任何疑惑可以回复我~
唯有时间不可辜负 2019-05-29 18:42:57

我也是这个错,百度出来都说是在主方法上加:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

但加了还是没用

0 回复 有任何疑惑可以回复我~
这样狠帅 2019-04-23 14:41:40

url后面加上时区和编码格式

?serverTimezone=UTC&characterEncoding=utf8

0 回复 有任何疑惑可以回复我~
  • 提问者 慕移动2445863 #1
    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
    回复 有任何疑惑可以回复我~ 2019-04-24 14:22:30
  • 提问者 慕移动2445863 #2
    还是这个错误
    回复 有任何疑惑可以回复我~ 2019-04-24 14:22:41
  • 谢了,我解决了
    回复 有任何疑惑可以回复我~ 2019-06-23 21:42:33
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信