|
|
|
@ -480,9 +480,9 @@ Finally, the following small application exercises the preceding configuration: |
|
|
|
|
|
|
|
|
|
|
|
public class Main { |
|
|
|
public class Main { |
|
|
|
|
|
|
|
|
|
|
|
public static void Main(String[] args) { |
|
|
|
public static void main(String[] args) { |
|
|
|
ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); |
|
|
|
ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); |
|
|
|
Calculator calc = (Calculator) ctx.getBean("calculator"); |
|
|
|
Calculator calc = ctx.getBean("calculator", Calculator.class); |
|
|
|
System.out.println(calc.add(2, 8)); |
|
|
|
System.out.println(calc.add(2, 8)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|