Search code examples
springdependency-injectionunity-container

Translate code from Unity .NET to Java Spring


I'm trying to convert code from C# to Java, with the Spring framework. Since the Java Spring framework provides more features (it's a framework) is seems doable.

More specifically, the C# code uses DI with the Unity .NET container with XML-config files. And I'd like to replace it with the DI features of the Java Spring framework, with @nnotations.

I don't know if there is, but I may as well ask : is there an automated way to do that ?

If not, are there any caveats ? By that, I mean :

  • Is there a 1-1 mapping of the DI features of the Unity vs Spring container ?
  • For example, are there features uniques to Unity .NET not found in the Java Spring framework ?
  • Are there unique (not found in Unity .NET) features found in the Java Spring framework that would help me make beautifull code ?

I've seen those links :

That last link is particularly interesting, but I am more looking for features of the DI part of the Spring framework only. Does it support interception ? Are there more "advanced" features ?


Solution

  • So there have been no answers, and I'll say how it went for me.

    • Besides the obvious .NET / Java platform respective advantages, both DI Containers provide the same base : Inversion of Control, so that is the main point here

    • Unity .NET is a container, while Spring is a framework (ie. a tool versus a way of life) Maybe that's why it's so hard to find a comparison.

    So I made one for me, I may as well share it :

    Unity .NET vs Spring Core Container