• spring,  Spring Interview Questions

    Types of IOC(Inversion of Control) or DI(Dependency Injection)

    There are two types of dependency injection: setter injection and constructor injection. Setter Injection: Normally in all the java beans, we will use setter and getter method to set and get the value of property as follows: public class namebean { String name;     public void setName(String a) {             name = a; }     public String getName() {     return name; }} We will create an instance of the bean ‘namebean’ (say bean1) and set property as bean1.setName(“tom”); Here in setter injection, we will set the property ‘name’ in spring configuration file as showm below: <bean id=”bean1″ class=”namebean”> <property name=”name” > <value>tom</value>…

    Comments Off on Types of IOC(Inversion of Control) or DI(Dependency Injection)
  • spring,  Spring Interview Questions

    IOC(Inversion of control) Vs DI(Dependency injection)

    IOC and DI are one of the same thing in aspects of Spring Framework, Both are meant to be for same functionality. Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as inversion of control or IOC, although technically speaking, dependency injection specifically refers to an implementation of a particular form of IOC.  Dependency Injection describes the situation where one object uses a second object to provide a particular capacity. For example, being passed a database connection as an argument to the constructor instead of creating one internally. The term “Dependency injection” is a misnomer, since it is not a dependency that is injected,…

    Comments Off on IOC(Inversion of control) Vs DI(Dependency injection)
  • spring,  Spring Interview Questions,  springExample

    What is Inversion Of Control(IOC)?

    Inversion of control or dependency injection (which is a specific type of IoC) is a term used to resolve objectdependencies by injecting an instantiated object to satisfy dependency as opposed to explicitly requesting anobject. So objects will not be explicitly requested but objects are provided as needed with the help of an Inversion Of Controller container (e.g. Spring etc). This is analogous to the Hollywood principal where the servicing objects say to the requesting client code (i.e. the caller) “don’t call us, we’ll call you”. Hence it is called inversion of control. Many of us are familiar with the software development context where client code collaborates with other dependent objects (or servicing objects) by…

    Comments Off on What is Inversion Of Control(IOC)?
  • Interview Questions,  spring,  Spring Interview Questions

    Differences between Object Oriented Programming and Aspect Oriented Programming?

    Object Oriented Programming (OOP) Works on System level code, OOP looks at an application as a set of collaborating objects. OOP code scatters system level code like logging, security etc with the business logic code. OOP works on elements like classes, objects, interfaces etc. Provides benefits such as code reuse, flexibility, improved maintainability, modular architecture, reduced development time etc with the help of polymorphism, inheritance and encapsulation. Aspect Oriented Programming (AOP) Aspect Oriented Programming works at the complex software system as combined implementation of multiple concerns like business logic, data persistence, logging, security, multithread safety, error handling, and so on. Separates business logic code from the system level code. In fact one concern remains unaware of other concerns. AOP has…

  • Interview Questions,  spring,  Spring Interview Questions

    Benefits of Aspect Oriented Programming

    Benefit of Aspect Oriented Programming Aspect Oriented Programming helps overcome system level coding i.e. Logging, Transaction or Security management problem by centralizing these cross-cutting concerns. Aspect Oriented Programming addresses each aspect separately in a modular fashion with minimal coupling and duplication of code. This modular approach also promotes code reuse by using a business logic concern with a separate logger aspect. Make easier to add newer functionality’s by adding new aspects and weaving rules and subsequently regenerating the final code. This ability to add newer functionality as separate aspects enable application designers to delay or defer some design decisions without the dilemma of over designing the application. Rapid development of evolutionary prototypes using OOP by focusing only…

    Comments Off on Benefits of Aspect Oriented Programming
  • Interview Questions,  spring,  Spring Basics,  Spring Interview Questions

    What is IOC also known as inversion of control?

    Inversion of control or dependency injection (which is a specific type of IoC) is a term used to resolve objectdependencies by injecting an instantiated object to satisfy dependency as opposed to explicitly requesting anobject. So objects will not be explicitly requested but objects are provided as needed with the help of an Inversion Of Controller container (e.g. Spring etc). This is analogous to the Hollywood principal where the servicing objects say to the requesting client code (i.e. the caller) “don’t call us, we’ll call you”. Hence it is called inversion of control. Many of us are familiar with the software development context where client code collaborates with other dependent objects (or servicing objects) by…

    Comments Off on What is IOC also known as inversion of control?
  • Interview Questions,  spring,  Spring Interview Questions

    What is Aspect Oriented Programming (AOP)?

    Aspect-Oriented Programming (AOP) complements OOP (Object Oriented Programming) by allowing thedeveloper to dynamically modify the static OO model to create a system that can grow to meet new requirements. AOP allows you to dynamically modify your static model consisting mainly of business logic to include the coderequired to fulfill the secondary requirements or in AOP terminology called cross-cutting concerns (i.e.secondary requirements) like auditing, logging, security, exception handling etc without having to modify theoriginal static model (in fact, we don’t even need to have the original code). Better still, we can often keep thisadditional code in a single location rather than having to scatter it across the existing model, as we…

    Comments Off on What is Aspect Oriented Programming (AOP)?
  • Interview Questions,  spring,  Spring Interview Questions

    Overview of the Spring framework? What are the benefits of Spring framework?

    The Spring framework is the leading full-stack Java/J2EE application framework. Unlike other frameworks, Spring does not impose itself on the design of a project due to its modular nature and, it has been divided logically into independent packages, which can function independently. It provides a light weight container and a non-invasive programming model enabled by the use of dependency injection (aka IoC), AOP (Aspect Oriented Programming), and portable service abstractions (JdbcTemplate, JmsTemplate etc). It includes abstraction layers for transactions, persistence frameworks (e.g. HibernateTemplate support forHibernate), Web development, a JDBC integration framework, an AOP integration framework, email support, Web Services (i.e. JAX-RPC) support etc. It also provides integration modules for popular Object-to-Relational (O/R) mapping tools like Hibernate,…

    Comments Off on Overview of the Spring framework? What are the benefits of Spring framework?
  • DI,  spring,  Spring Basics,  Spring Interview Questions

    Different types of dependency injection(DI)

    There are two types of dependency injection: setter injection and constructor injection. Setter Injection: Normally in all the java beans, we will use setter and getter method to set and get the value of property as follows: public class namebean {String name; public void setName(String a) {name = a; }public String getName() {return name; }} We will create an instance of the bean ‘namebean’ (say bean1) and set property as bean1.setName(“tom”); Here in setter injection, we will set the property ‘name’ in spring configuration file as showm below:<bean id=”bean1″ class=”namebean”><property name=”name” ><value>tom</value></property></bean>The subelement <value> sets the ‘name’ property by calling the set method as setName(“tom”); This process is called setter…

    Comments Off on Different types of dependency injection(DI)
  • DI,  IOC,  spring,  Spring Basics,  Spring Interview Questions

    Inversion of Control (IOC) Vs Dependency Injection (DI)

    IOC and DI are one of the same thing in aspects of Spring frame work, Both are meant to be for same functionality. Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as inversion of control or IOC, although technically speaking, dependency injection specifically refers to an implementation of a particular form of IOC. Dependency Injection describes the situation where one object uses a second object to provide a particular capacity. For example, being passed a database connection as an argument to the constructor instead of creating one internally. The term “Dependency injection” is a misnomer, since it is not a dependency that is…

    Comments Off on Inversion of Control (IOC) Vs Dependency Injection (DI)