Saturday, 17 February 2018

What is @Override in Spring

             What is @Override in Spring




1)If programmer makes any mistake such as wrong method name, wrong parameter types while overriding, you would get a compile time error.

2)It improves the readability of the code.


ApplicationContext

                       ApplicationContext



The ApplicationContext is the central interface within a Spring application for providing configuration information to the application. It is read-only at run time, but can be reloaded if necessary and supported by the application. A number of classes implement the ApplicationContext interface, allowing for a variety of configuration options and types of applications.

                                                    1) One Way

package com.springpg;

import org.springframework.context.support.GenericXmlApplicationContext;

public class Test {

public static void main(String[] args) {
// TODO Auto-generated method stub
GenericXmlApplicationContext cn = new GenericXmlApplicationContext("NewFile.xml");
Classpg obj = cn.getBean("helloWorld",Classpg.class);
obj.show();
}
}


2) Second Way
package com.springpg;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new ClassPathXmlApplicationContext("NewFile.xml");
Classpg obj = (Classpg) context.getBean("helloWorld");
obj.show();

}

}

Introduction of Spring technology

            Introduction of Spring technology

 

The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE (Enterprise Edition) platform. Although the framework does not impose any specific programming model, it has become popular in the Java community as an addition to, or even replacement for the Enterprise JavaBeans (EJB) model. The Spring Framework is open source.

Logging in Spring

                      Logging in Spring Logging is a very important dependency for Spring because a) it is the only mandatory external de...