Reputation: 7407
I'm using Spring.NET's IoC container and everything has been working just fine....until now. Somehow, in one of our previous releases, we introduced a circular dependency. Since we use setter based injection as opposed to constructor based injection, Spring.NET just kept humming along fine, but the behavior of our app changed.
Now I have a solution with a hundred or so components, and somewhere in that pile of components exists a circular dependency, which I now need to find.
Are there any tools that can take my Spring.NET config files and give me a graphical picture of my components and their dependencies?
Upvotes: 3
Views: 605
Reputation: 10557
AFAIK there isn't such a tool available, although there is one for spring for Java. This thread on the spring.net forum discusses the issue and proposes a solution. I made a quick-and-dirty proof of concept based on Thomas Darimont's approach using QuickGraph.
For the following configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="a1" type="q7446068.ClassA, q7446068" >
<property name="MyOtherA" ref="a2" />
</object>
<object id="a2" type="q7446068.ClassA, q7446068" >
<property name="MyOtherA" ref="a1" />
</object>
<object id="a3" type="q7446068.ClassA, q7446068" />
</objects>
I was able to create the following dot file:
digraph G {
0 [label="a1"];
1 [label="a2"];
2 [label="a3"];
0 -> 1 [];
1 -> 0 [];
}
Which shows the circular dependency.
The code is available as a gist.
Upvotes: 3