InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
What Are The Common Implementations Of The Applicationcontext? |
|
Answer» The three COMMONLY used implementation of 'APPLICATION Context' are: FileSystemXmlApplicationContext: This container loads the definitions of the beans from an XML file. Here you NEED to provide the FULL path of the XML bean configuration file to the constructor. ClassPathXmlApplicationContext: This container loads the definitions of the beans from an XML file. Here you do not need to provide the full path of the XML file but you need to set CLASSPATH properly because this container will look bean configuration XML file in CLASSPATH. WebXmlApplicationContext: This container loads the XML file with definitions of all beans from within a web application. The three commonly used implementation of 'Application Context' are: FileSystemXmlApplicationContext: This container loads the definitions of the beans from an XML file. Here you need to provide the full path of the XML bean configuration file to the constructor. ClassPathXmlApplicationContext: This container loads the definitions of the beans from an XML file. Here you do not need to provide the full path of the XML file but you need to set CLASSPATH properly because this container will look bean configuration XML file in CLASSPATH. WebXmlApplicationContext: This container loads the XML file with definitions of all beans from within a web application. |
|
| 52. |
Give An Example Of Beanfactory Implementation.? |
|
Answer» The most commonly USED BeanFactory implementation is the XmlBeanFactory class. This container reads the configuration metadata from an XML file and uses it to CREATE a fully CONFIGURED SYSTEM or APPLICATION. The most commonly used BeanFactory implementation is the XmlBeanFactory class. This container reads the configuration metadata from an XML file and uses it to create a fully configured system or application. |
|
| 53. |
What Are Types Of Ioc Containers? Explain Them. |
|
Answer» There are TWO types of IoC containers: Bean Factory container: This is the simplest container providing basic support for DI .The BeanFactory is usually preferred where the resources are limited like mobile devices or applet BASED applications Spring ApplicationContext Container: This container adds more enterprise-specific functionality such as the ability to resolve textual messages from a PROPERTIES file and the ability to publish APPLICATION events to interested event LISTENERS. There are two types of IoC containers: Bean Factory container: This is the simplest container providing basic support for DI .The BeanFactory is usually preferred where the resources are limited like mobile devices or applet based applications Spring ApplicationContext Container: This container adds more enterprise-specific functionality such as the ability to resolve textual messages from a properties file and the ability to publish application events to interested event listeners. |
|
| 54. |
What Is Spring Ioc Container? |
|
Answer» The SPRING IoC CREATES the objects, wire them together, CONFIGURE them, and manage their complete lifecycle from creation till destruction. The Spring container uses dependency injection (DI) to manage the components that MAKE up an application. The Spring IoC creates the objects, wire them together, configure them, and manage their complete lifecycle from creation till destruction. The Spring container uses dependency injection (DI) to manage the components that make up an application. |
|
| 55. |
What Are The Benefits Of Ioc? |
|
Answer» The main benefits of IOC or dependency INJECTION are:
The main benefits of IOC or dependency injection are: |
|
| 56. |
Which Di Would You Suggest Constructor-based Or Setter-based Di? |
|
Answer» Since you can MIX both, Constructor- and Setter-based DI, it is a GOOD rule of thumb to use constructor arguments for mandatory DEPENDENCIES and setters for optional dependencies. Note that the use of a @Required annotation on a setter can be used to MAKE setters required dependencies. Since you can mix both, Constructor- and Setter-based DI, it is a good rule of thumb to use constructor arguments for mandatory dependencies and setters for optional dependencies. Note that the use of a @Required annotation on a setter can be used to make setters required dependencies. |
|
| 57. |
What Are The Different Types Of Ioc (dependency Injection)? |
|
Answer» Types of IoC are: Constructor-based dependency INJECTION: Constructor-based DI is accomplished when the container INVOKES a class constructor with a NUMBER of arguments, each representing a dependency on other class. Setter-based dependency injection: Setter-based DI is accomplished by the container CALLING setter methods on your BEANS after invoking a no-argument constructor or no-argument static factory method to instantiate your bean. Types of IoC are: Constructor-based dependency injection: Constructor-based DI is accomplished when the container invokes a class constructor with a number of arguments, each representing a dependency on other class. Setter-based dependency injection: Setter-based DI is accomplished by the container calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean. |
|
| 58. |
What Is Dependency Injection? |
|
Answer» INVERSION of CONTROL (IoC) is a GENERAL concept, and it can be expressed in many different ways and Dependency Injection is merely one concrete example of Inversion of Control. This concept says that you do not create your objects but describe how they should be created. You don't DIRECTLY connect your components and services TOGETHER in code but describe which services are needed by which components in a configuration file. A container (the IOC container) is then responsible for hooking it all up. Inversion of Control (IoC) is a general concept, and it can be expressed in many different ways and Dependency Injection is merely one concrete example of Inversion of Control. This concept says that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (the IOC container) is then responsible for hooking it all up. |
|
| 59. |
What Is Spring Configuration File? |
|
Answer» SPRING configuration file is an XML file. This file contains the CLASSES information and describes how these classes are configured and INTRODUCED to each other. Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other. |
|
| 60. |
What Are The Different Modules In Spring Framework? |
|
Answer» Following are the modules of the Spring FRAMEWORK:
Following are the modules of the Spring framework: |
|
| 61. |
What Are Benefits Of Using Spring? |
|
Answer» Following is the LIST of few of the great benefits of using Spring Framework: Lightweight: Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 2MB. Inversion of control (IOC): Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies INSTEAD of creating or looking for dependent objects. Aspect oriented (AOP): Spring SUPPORTS Aspect oriented programming and enables cohesive development by separating application business LOGIC from system services. Container: Spring contains and manages the life cycle and configuration of application objects. MVC Framework: Spring's web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks. Transaction Management: Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single database, for example) and scale up to global transactions (using JTA, for example). Exception Handling: Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, HIBERNATE, or JDO, for example) into consistent, unchecked exceptions. Following is the list of few of the great benefits of using Spring Framework: Lightweight: Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 2MB. Inversion of control (IOC): Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects. Aspect oriented (AOP): Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services. Container: Spring contains and manages the life cycle and configuration of application objects. MVC Framework: Spring's web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks. Transaction Management: Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single database, for example) and scale up to global transactions (using JTA, for example). Exception Handling: Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions. |
|
| 62. |
What Is Spring? |
|
Answer» Spring is an open source development framework for ENTERPRISE Java. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on TOP of the Java EE platform. Spring framework targets to make J2EE development easier to USE and promote GOOD PROGRAMMING practice by enabling a POJO-based programming model. Spring is an open source development framework for enterprise Java. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model. |
|