SpringBoot启动时,不想连接mysql

在拆分服务的时候,因为当前服务没有使用到mysql数据库。便把mysql配置文件删除。结果报错:


***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles "local" are currently active).

这个问题以前也碰到过,那时候没有开始写博客,纪录一下。 因为SpringBoot启动时会默认加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,而mysql的配置文件又被删掉了。spring找不到datasource注入因此报错。

解决方法是: spring boot 不连接数据库启动
在启动类上加上注解 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})})


   转载规则


《SpringBoot启动时,不想连接mysql》 echi1995 采用 知识共享署名 4.0 国际许可协议 进行许可。
 上一篇
Unable to store Job:'todoJobGroup.1183894449946624', because one already exists with this identification. Unable to store Job:'todoJobGroup.1183894449946624', because one already exists with this identification.
在今天迭代上线后,测试突然发现了一个bug.去pro环境看了一下log 2019-08-02 17:52:40.756 ERROR 18408 --- [nio-8084-exec-2] c.g.common.eventbus.EventB
下一篇 
想使用Set去重,又想保持插入顺序 想使用Set去重,又想保持插入顺序
###问题描述 今天在做项目时,老大过来瞄了一眼代码,对其中使用Set表示不满.他认为,应该使用ArrayList,自己手动去去重以保证插入时的顺序. 当场我第一个想到的是使用TreeSet保证顺序.但是TreeSet是按自然顺序排序的,
  目录