所以在最新版本的 Spring 中,我们可以使用@Configuration注解来设置 Spring 的配置。现在在 JavaConfig 中,可以使用@AnnotationDrivenTx(@AnnotationDrivenTx 参考链接)注解在我们的 Config 类中设置事务。但是由于 JavaConfig 已经退役,我想知道是否有人知道如何在没有 JavaConfig 并且不需要向application-context.xml. 这是我的 Config 类的基本内容
@Configuration
@ImportResource("config/application-context.xml")
public class Config {
public @Bean DataSource dataSource() {
//get and return datasource
}
public @Bean Service1 getService1() {
//return service1Impl
}
}
而且我想进行Service1交易。如果有人对如何做到这一点有任何想法,或者如果这是不可能的,请告诉我。
谢谢!