More Related Content Similar to Software Engineering Similar to Software Engineering (20) Software Engineering7. package com.iclutton.seday.language; public interface Language { String sayHello(); } package com.iclutton.seday.language; public class English implements Language{ @Override public String sayHello() { return "Hello"; } } package com.iclutton.seday.language; public class French implements Language{ @Override public String sayHello(){ return "Bonjour"; } } 11. <bean id="language" class="com.iclutton.seday.language.English"/> <bean id="hello" class="com.iclutton.seday.HelloWorld"> <property name="language" ref="language"/> </bean> @Test public void testSpring(){ // setup ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); HelloWorld helloWorld = (HelloWorld)applicationContext.getBean("hello"); // act String result = helloWorld.sayHello(); // assert assertEquals("Hello", result); } 17. # Root category log4j.rootLogger=DEBUG, stdout log4j.logger.com.iclutton.seday=DEBUG # CONSOLE log4j.appender.stdout.Threshold=DEBUG log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %X{stackname}[%t] %-5p [%C {1}.%M() %L] - %m%n 2008-11-18 18:06:39,953 [main] DEBUG [AbstractAutowireCapableBeanFactory$1.run() 411] - Finished creating instance of bean 'hello' 2008-11-18 18:06:39,953 [main] DEBUG [AbstractApplicationContext.publishEvent() 273] - Publishing event in context [org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2]: org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2]; startup date [Tue Nov 18 18:06:39 GMT 2008]; root of context hierarchy] 2008-11-18 18:06:39,953 [main] DEBUG [AbstractBeanFactory.doGetBean() 214] - Returning cached instance of singleton bean 'hello'