Get readable Spring circular link information

Just to keep it reasonable, I'm telling Spring about banning circular links:

    _context = new ClassPathXmlApplicationContext(getApplicationContextFiles(), false);
    _context.setAllowCircularReferences(false);
    _context.refresh();
    _context.start();

The problem is that the resulting stack trace actually looks like barf: |

How can I get simple output of circular links similar to:

Unresolved circular reference: [aBean->nextBean->otherBean->aBean]

?

+3
source share
3 answers

, ( , beans, ). , bean, initBeanDefinitionReader(), beanDefinitionReader setEventListener ( XmlBeanDefinitionReader).

ComponentDefinitions . ComponentDefinitions , - JDepend jdepend.framework.JavaPackage., ComponentDefinition getBeanDefinitions() getBeanReferences() (, , getInnerBeanDefinitions()) "JavaPackage" . , JavaPackage, , true containsCycle()

+2

" Spring IDE"? . , DI, , ...

+1

, , - script (, Python, , , Groovy), :

  • bean, (A, B), , B A. A, B .. , (A, B) - .
  • . . . , Google - .
  • , ( ).

This may seem a bit complicated, but actually it is not. I often solved similar problems using Python scripts.

+1
source

Source: https://habr.com/ru/post/1710976/


All Articles