Skip to content

Instantly share code, notes, and snippets.

Last active December 28, 2015 04:09
Show Gist options
  • Save garystafford/7440854 to your computer and use it in GitHub Desktop.
Save garystafford/7440854 to your computer and use it in GitHub Desktop.
Main class file from blog post 'Spring Integration with Eclipse Using Maven':
package com.blogpost.maven.maven_spring;
import org.springframework.context.ApplicationContext;
public class App {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
MaintainVehicle maintain = new MaintainVehicle();
// vehicle1 bean
Vehicle obj1 = (Vehicle) context.getBean("vehicle1");
System.out.printf("I drive a %s.\n", obj1.getLongDescription());
System.out.printf("Is my %s tuned up? %s\n",
obj1.getShortDescription(), obj1.getServiced());
System.out.printf("Is my %s tuned up, yet? %s\n\n", obj1.getMake(),
// vehicle2 bean
Vehicle obj2 = (Vehicle) context.getBean("vehicle2");
System.out.printf("My wife drives a %s.\n", obj2.getLongDescription());
System.out.printf("Is her %s clean? %s\n", obj2.getShortDescription(),
System.out.printf("Is her %s clean, now? %s\n\n", obj2.getMake(),
// vehicle3 bean
Vehicle obj3 = (Vehicle) context.getBean("vehicle3");
System.out.printf("Our son drives his %s too fast!\n", obj3.getType()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment