deep injection - spring

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2012-09-21T14:23:50Z Indexed on 2012/09/21 15:38 UTC
Read the original article Hit count: 268

What is the best way (or options) for accessing spring components at layers deep within the application that aren't managed by spring?

For example, I have a low level utility POJO class into which I need to autowire/inject a spring component. I'll call it LowLevelHelper. There are multiple classes that use LowLevelHelper - most are layers away from anything that is hooked up with spring.

One option would be to make all the layers in to spring components, but that seems like I'm hacking my design to force spring to help me. I have some complex things going on that won't be nearly as clean if I have to @Autowire all the pieces and don't new anything. Another option might be to manually inject the component in the low level class, but I'm not really sure if this is possible or the right solution.

© Stack Overflow or respective owner

Related posts about spring

Related posts about dependency-injection