com.start.boot.Runner.java Source code

Java tutorial

Introduction

Here is the source code for com.start.boot.Runner.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.start.boot;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 *
 * @author nithin
 */
public class Runner {

    private static ApplicationContext ctx;

    public static void main(String[] args) {

        ctx = new AnnotationConfigApplicationContext(CoreConfigurer.class);

        // now both beans A and B will be available...
        Club a = ctx.getBean(Club.class);
        Person b = ctx.getBean(Person.class);

        System.out.println(a.getName() + a.getId());
        System.out.println(b.getId() + b.getName());
        ctx = null;
    }
}