加了
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
为什么启动还是报错:
Caused by: io.seata.common.exception.ShouldNeverHappenException: Auto proxy of DataSource can't be enabled as you've created a DataSourceProxy bean.Please consider removing DataSourceProxy bean or disabling auto proxy of DataSource
seata启动报错:Auto proxy of DataSource can't be enabled as you've created a DataSourceProxy bean.Please consider removing DataSourceProxy bean or disabling auto proxy of DataSource.
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- thomas.he 2020-08-17 11:28关注
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
设置之后再注册下再写加载Bean
@Bean @ConfigurationProperties(prefix = "spring.datasource") public DataSource druidDataSource() { DruidDataSource druidDataSource = new DruidDataSource(); return druidDataSource; } @Primary @Bean("dataSource") public DataSourceProxy dataSource(DataSource druidDataSource) { return new DataSourceProxy(druidDataSource); } @Bean public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setDataSource(dataSourceProxy); sqlSessionFactoryBean.setTypeAliasesPackage("com.bitter.storage.domain"); MybatisConfiguration configuration = new MybatisConfiguration(); configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); configuration.setJdbcTypeForNull(JdbcType.NULL); sqlSessionFactoryBean.setConfiguration(configuration); sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory()); return sqlSessionFactoryBean.getObject(); }
解决评论 打赏 举报无用 10
悬赏问题
- ¥20 WPF MVVM模式 handycontrol 框架, hc:SearchBar 控件 Text="{Binding NavMenusKeyWords}" 绑定取不到值
- ¥15 需要手写数字信号处理Dsp三个简单题 不用太复杂
- ¥15 数字信号处理考试111
- ¥15 allegro17.2生成bom表是空白的
- ¥15 请问一下怎么打通CAN通讯
- ¥20 如何在 rocky9.4 部署 CDH6.3.2?
- ¥35 navicat将excel中的数据导入mysql出错
- ¥15 rt-thread线程切换的问题
- ¥15 高通uboot 打印ubi init err 22
- ¥15 R语言中lasso回归报错