Dependency Lookup is when your class is responsible for getting its dependencies from some lookup factory, (this is similar to a JNDI lookup).
for example ClassA has a ClassB,
in ClassA you will have a code something like this
while a Dependency Injection is when your class is given a dependency by some factory or framework
example ClassA has a ClassB,
you can see in Dependency Injection that the framework was responsible for injecting the instance of ClassB.
SCJA, SCJP, SCJD, SCMAD, SCWCD, SCBCD, SCDJWS, SCEA, SOA, Spring Certified, OCP MySQL 5 Developer, PMP
Yes and no, I like the code of MyClass, the next part is how you tell Spring there is the dependency between MyClass and the Hello class.
You can define another bean of type MyClass in your configuration and use a <property> tag in that <bean> tag that points or "ref"s references your "hello" bean. That is if you want it defined in the xml.
The other choice is to use Annotations. the @Autowired (Spring annotation) or the @Resource (JSR-250 annotation) does the trick. But to use annotations you have to put in the xml file that you are using annotations.
Now, if MyClass is not going to be a Spring Bean, then in MyClass you need to get a reference to the ApplicationContext object and call the getBean(String beanName) method.