问答详情
源自:2-2 SpringBoot的搭建与启动下

没有使用数据库,它运行报错

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).


提问者:慕粉6955152 2018-12-18 13:23

个回答

  • 慕UI5031919
    2019-07-11 16:26:48

    https://img.mukewang.com/5d26f2be000130b706410172.jpg???

  • 慕UI5031919
    2019-07-11 16:21:24

    https://img4.mukewang.com/5d26f17500011b2709860356.jpg还是不行啊

  • 慕UI5031919
    2019-07-11 16:13:58

    这是怎么解决的呀,兄弟

  • 慕粉4019140
    2018-12-19 15:02:22


    //因为  springboot启动时会自动注入数据源和配置jpa 
    //所以  在@SpringBootApplication中排除其注入 
    @SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})