When I executed Run → Spring Boot Application
in Eclipse,
The following error has occurred.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in hoge.fuga.PiyoRepositoryImpl required a bean of type 'hoge.fuga.PiyoMapper' that could not be found.
Action:
Consider defining a bean of type 'hoge.fuga.PiyoMapper' in your configuration.
It looks like Mapper couldn't be found. I forgot to load Mapper with @MapperScan.
Defined @MapperScan.
@SpringBootApplication
@MapperScan(basePackages = "hoge.fuga") //← Set a package with Mapper class
public class DemoApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(DemoApplication.class, args);
}
}
I think that one of the measures described in the item of Mapper automatic detection
on the following site is necessary.
http://www.mybatis.org/spring/ja/mappers.html
Recommended Posts