Spring container and sequential steps

package com.mgt.springdemo;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringApp {

public static void main(String[] args) {

// load the spring configuration file
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("applicationContext.xml");

// retrieve bean from spring container
Book b= context.getBean("myBook", Book.class);

// call methods on the bean
System.out.println(b.getBookDetail());

// close the context
context.close();
}

}







Comments

Popular posts from this blog

Git Commands With Output Log

Java Interview Preparation (conceptual)

Java 8 Function Interface