Wenn ich in Eclipse "Ausführen → Spring Boot-Anwendung" ausgeführt habe, Der folgende Fehler ist aufgetreten.
***************************
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.
Es sieht so aus, als ob Mapper nicht gefunden werden konnte. Ich habe vergessen, Mapper mit @MapperScan zu laden.
Definierter @MapperScan.
@SpringBootApplication
@MapperScan(basePackages = "hoge.fuga") //← Legen Sie ein Paket mit der Mapper-Klasse fest
public class DemoApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(DemoApplication.class, args);
}
}
Ich denke, dass eine der Maßnahmen, die im Punkt "Automatische Erkennung von Mapper" auf der folgenden Website beschrieben sind, notwendig ist. http://www.mybatis.org/spring/ja/mappers.html
Recommended Posts