Giter VIP home page Giter VIP logo

Comments (6)

Ozal220 avatar Ozal220 commented on July 16, 2024

在application类上添加注解:@MapperScan(basePackages = "org.sang.mapper")

from vblog.

zuoee avatar zuoee commented on July 16, 2024

image
image
下载下来就改了下配置文件,报错,刚学习spring boot,什么原因报错?

from vblog.

zuoee avatar zuoee commented on July 16, 2024

需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。

以上,网搜的,改好后运行,也报了题主同样的错误,但是加了楼上的注解,错误更多了。。。

package org.sang;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableScheduling//开启定时任务支持
@MapperScan(basePackages = "org.sang.mapper")
public class BlogserverApplication {

public static void main(String[] args) {
    SpringApplication.run(BlogserverApplication.class, args);
}

}

image
image

from vblog.

zuoee avatar zuoee commented on July 16, 2024

resources文件夹右击 mark directory as resources root,看了之前关闭的问题,IEDEA这样操作解决了。

from vblog.

wanxu2019 avatar wanxu2019 commented on July 16, 2024

@zuoee 我也遇到这个问题,发现是因为资源文件没被打包,从IDE层面去设置不如从代码层面去修改,我的解决方案是:在pom文件标签内增加一个资源节点:
<resource> <directory>src/main/resources</directory> <includes> <include>**/*.*</include> </includes> </resource>

from vblog.

zau11berer avatar zau11berer commented on July 16, 2024

更新mybatis框架到2.0.0之后,项目即可以运行

尝试过close上的做法,没有作用,而且看文件夹格式和pom文件,resource Root作者应该是已经修改过了

from vblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.