springboot项目启动报错:Failed to configure a DataSource: ‘url‘ attribute is not specified......

问题:

Springboot项目启动报错:

Failed to configure a DataSource: 'url' attribute is not specified and

no embedded datasource could be configured

解决办法:

自己的这个项目不用连数据库,直接将@SpringBootApplication修改为@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}),就可以设置项目不连接数据库

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
public class Demo4Application {

    public static void main(String[] args) {

        SpringApplication.run(Demo4Application.class, args);
    }

}

你可能感兴趣的:(java学习,spring,boot,后端,java)