JiangJuHong commented on issue #3298: URL: https://github.com/apache/incubator-seata/issues/3298#issuecomment-3277195340
参考官方评论,使用自定义跳过bean逻辑,#1458,我的项目是 Mongo + Mybatis + Seata + JRebel,通过以下配置不扫描mongo能够解决此问题,同理,如果是jpa,将 `if (bean instanceof MongoRepository) return false;` 替换为对应 Repository 即可. > 通过 ConditionalOnExpression 限定仅在开发环境启用此配置,可根据需求决定是否使用. 示例代码: ```java /** * 自定义Seata扫描配置,解决:Seata + JPA(Mongo) + JRebel 项目无法启动问题 * 注意:此配置类仅在dev模式下生效 */ @Slf4j @Configuration @ConditionalOnExpression("'${spring.profiles.active:}'.contains('dev')") public class CustomSeataScannerCheckerConfig implements ScannerChecker { public CustomSeataScannerCheckerConfig() { log.info("CustomSeataScannerCheckerConfig init, seata dev skip MongoRepository check!"); } @Override public boolean check(Object bean, String beanName, @Nullable ConfigurableListableBeanFactory beanFactory) throws Exception { if (bean instanceof MongoRepository) return false; return true; } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org