How to force update bean in Transactional
& Async
Method in spring boot?
I want it to save immediately at specific point and not at the end of the transactional function
import javax.transaction.Transactional;
@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {
@Autowired
private CustomerRepository customerRepository;
@Override
@Async
public void sendAllWithQueryParam(Customer customer) {
// some code
customerRepository.save(customer);
// extre code
}
}
Also note that, when I added @org.springframework.transaction.annotation.Transactional(propagation = Propagation.REQUIRES_NEW)
to the method, it also doesn't work.