Browse Source

fix(video): MapperScan改用注解过滤修复生命周期存储歧义

Kazerin 3 tuần trước cách đây
mục cha
commit
fa21824e80

+ 5 - 3
video-service/src/main/java/com/zksy/video/VideoApplication.java

@@ -13,9 +13,11 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
 
 @EnableScheduling
-// Both com.zksy.video mappers carry @Mapper themselves; a package-wide scan here would also
-// register ordinary interfaces (e.g. VideoLifecycleStore) as mappers and break injection.
-@MapperScan(basePackages={"com.ruoyi.wvp.mapper"})
+// Scan only interfaces annotated with @Mapper. Declaring @MapperScan at all disables the
+// starter's automatic scan, so both packages must be listed; the annotation filter keeps
+// ordinary interfaces (e.g. VideoLifecycleStore) from being registered as mappers.
+@MapperScan(basePackages = {"com.zksy.video", "com.ruoyi.wvp.mapper"},
+        annotationClass = org.apache.ibatis.annotations.Mapper.class)
 @SpringBootApplication(scanBasePackages = {"com.zksy.video", "com.ruoyi.wvp"}, exclude = {DataSourceAutoConfiguration.class,UserDetailsServiceAutoConfiguration.class})
 public class VideoApplication {
     public static void main(String[] args) { SpringApplication.run(VideoApplication.class, args); }