15 lines
1.1 KiB
HTML
15 lines
1.1 KiB
HTML
<p>spring boot 创建项目引用mybatis后,直接运行会提示:</p>
|
||
<blockquote>
|
||
<p>Cannot determine embedded database driver <span class="hljs-keyword">class <span class="hljs-keyword">for database <span class="hljs-class"><span class="hljs-keyword">type <span class="hljs-title">NONE</span></span></span></span></span></p>
|
||
</blockquote>
|
||
<p>因为springboot启动时会自动注入数据源</p>
|
||
<p>使用@SpringBootApplication注解排除注入即可</p>
|
||
<div class="cnblogs_code">
|
||
<pre>@SpringBootApplication(exclude={DataSourceAutoConfiguration.<span style="color: #0000ff;">class</span><span style="color: #000000;">})
|
||
</span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> Application {
|
||
</span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> main(String[] args){
|
||
SpringApplication.run(Application.</span><span style="color: #0000ff;">class</span><span style="color: #000000;">, args);
|
||
}
|
||
}</span></pre>
|
||
</div>
|
||
<p> </p> |