Skip to main content

Posts

Showing posts from April, 2011

Java Reflections

Java Reflections is one of the most powerful API in Java. Java Reflection API allows us to access metadata about the classes at runtime i.e. Reflections allows us to find out constructors, fields and methods from a Java class.
In this post I will show how to find out constructors, fields and methods from a Java class.

Dependency Injection

Dependency Injection i.e. Inversion Of Control. I have been asked this question so many times that "What is dependency injection?" so, I felt that I should write something about it.. So what is Dependency Injection?? Dependency Injection is the process of not to create objects explicitly but to describe how they should be created. As I am working on Spring and Hibernate so this question has been asked for Spring, so how does spring uses it?
In Spring, it uses XML file where we describe how beans(objects) should be created, Spring uses this XML file and creates objects and we simply use these beans in our project. Consider following scenario,