Using the following code causes the transaction to fail in spring boot2.7.17,I tracked the spring aop proxy source, found that the last container of agent only one MethodValidateInterceptor advisor, and no TransactionInterceptor, please help see what reason is this, please help see what reason is this,thanks!

@Service
@Validated
public class XxxService implements ApplicationContextAware {

    @Resource
    private XxxDAO xxxDAO;

    private Object obj;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        obj = applicationContext.getBean(getClass());// Adding this line will cause the @Transactional transaction to not work
    }

    @Transactional(rollbackFor = Exception.class)
    public void test() {
        xxxDAO.insert(new XxxDO().setName("test111"));
        int i = 1 / 0;// throw runtime exception
        xxxDAO.insert(new XxxDO().setName("test222"));
    }

}

Comment From: funtower

I discovered that the apparent reason for this last observation is the use of both @Validated and @Transactional annotations, and the cyclic dependency that occurs when ob j is assigned during the post-bean initialization phase

Comment From: snicoll

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.