springboot auto config TransactionManager
和SqlFactory
,它运行良好,但当我使用@Transactional
程序等待发呆时,我会流动代码并查找
beanFactory.getBean(PlatformTransactionManager.class)
非常慢。
但是当我添加这个:
@Autowired
private PlatformTransactionManager platformTransactionManager;
它有效。所以有什么问题。我不知道,我现在正在使用带有springboot的grpc,请帮助thx;
@Configuration
@SpringBootApplication
@ComponentScan(value = "cn.com.autohome.autopay.wallet")
@EnableTransactionManagement
@EnableAutoConfiguration
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class AppMain extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(AppMain.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(AppMain.class);
}
}
@Configuration
@MapperScan(basePackages = "cn.com.autohome.autopay.wallet.core.dal.mapper")
@ImportResource(locations = {"classpath:wallet-dal-bean.xml"})
public class WalletMyBatisConfig {
@Autowired
private DataBaseProperties dataBaseProperties;
@Primary
@Bean(name = "walletDataSource")
@ConfigurationProperties("spring.datasource.druid")
public DataSource masterDataSource() throws SQLException {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
dataSource.setDriverClassName(dataBaseProperties.getWallet_data_source_driver_class());
dataSource.setUrl(dataBaseProperties.getWallet_data_source_url());
dataSource.setUsername(dataBaseProperties.getWallet_data_source_username());
dataSource.setPassword(dataBaseProperties.getWallet_data_source_password());
return dataSource;
}
}