我只是无法理解。bean 是否用@Serviced 标记并由@ComponentScan 在应用程序上下文中注册,是否通过@Transaction 注释代理事务支持?
这工作正常:
public class LocationManagerImpl implements LocationManager {
@Transactional
public void saveLocation(Location location) {
}
}
//config class
@Bean
public LocationManager locationManager() {
return new LocationManagerImpl();
}
这不会:
@Service
public class LocationManagerImpl implements LocationManager {
@Transactional
public void saveLocation(Location location) {
}
}