Tampilkan postingan dengan label spring interview questions. Tampilkan semua postingan
Tampilkan postingan dengan label spring interview questions. Tampilkan semua postingan

Jumat, 18 Januari 2013

Setting JNDI Database Connection pool in Spring and Tomcat is pretty easy. Tomcat server documentation gives enough information on how to setup connection pool in Tomcat 5, 6 or 7. Here we will use Tomcat 7 along with spring framework for creating a connection pool in Tomcat server and accessing them in Spring using JNDI code. In our last article, we have seen how to setup database connection pool in Spring for core Java application which doesn't run on web server or application server and doesn't have managed J2EE container. but if you are developing web application than its better to use server managed connection pool and access them using JNDI. Spring configuration will be generic and just based on JNDI name of Datasource so it will work on any J2EE Server e.g. glassfish, WebLogic, JBoss or WebSphere until JNDI name is same. Tomcat is my favorite web server and I use it a lot on development and its comes integrated with IDE like Eclipse and Netbeans. I am using it for all test and development purpose, Though beware with java.lang.OutOfMemoryError: PermGen space in tomcat,
Read more �

Sabtu, 15 Desember 2012

Inversion of Control and Dependency Injection is a core design pattern of Spring framework. IOC and DI design pattern is also a popular design pattern interview question in Java. As the name suggest Inversion of control pattern Inverts responsibility of managing the life cycle of the object e.g. creating an object, setting their dependency etc from application to a framework, which makes writing Java application even more easy. The programmer often confused between IOC and DI, well both words used interchangeably in Java world but Inversion of Control is a more general concept and Dependency Injection is a concrete design pattern. Spring framework provides two implementations of IOC container in the form of Application Context and BeanFactory which manages life-cycle of bean used by Java application. As you may know, necessity is the mother of invention, it benefits to first understand problem solved by IOC and Dependency Injection design pattern. This makes your understanding more clear and concrete.
Read more �

Jumat, 23 November 2012

BeanFactory vs ApplicationContext
The difference between BeanFactory and ApplicationContext in Spring framework is another frequently asked Spring interview question mostly asked Java programmers with 2 to 4 years experience in Java and Spring. Both BeanFactory and ApplicationContext provides a way to get a bean from Spring IOC container by calling getBean("bean name"), but there is some difference in there working and features provided by them. One difference between bean factory and application context is that former only instantiate bean when you call getBean() method while ApplicationContext instantiates Singleton bean when the container is started, It doesn't wait for getBean to be called. This interview questions is third on my list of frequently asked spring questions e.g. Setter vs Constructor Injection and What is default scope of Spring bean. If you are preparing for Java interview and expecting some Spring framework question, It�s worth preparing those questions.
Read more �

Senin, 19 November 2012

Spring Setter vs Constructor Injection
Spring supports two types of dependency Injection, using setter method e.g. setXXX() where XXX is a dependency or via a constructor argument. The first way of dependency injection is known as setter injection while later is known as constructor injection. Both approaches of Injecting dependency on Spring bean has there pros and cons, which we will see in this Spring framework article. The difference between Setter Injection and Constructor Injection in Spring is also a popular Spring framework interview question.Some time interviewer also asks as When do you use Setter Injection over Constructor injection in Spring or simply benefits of using setter vs constructor injection in Spring framework. Points discussed in this article not only help you to understand Setter vs Constructor Injection but also Spring's dependency Injection process.
Read more �