标签:[] scheduler ann conf rgs java color pre void
@Configuration //注册该类作为javaconfig public class ApplicationConfig { @Bean(name = "helloBean") //注册该对象为bean public Helloworld helloworld(){ return new HelloworldImpl(); } }
public class Application { public static void main(String[] args){ ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ApplicationConfig.class); Helloworld helloworld = (Helloworld) applicationContext.getBean("helloBean"); helloworld.printHelloWorld("This is Spring_JavaConfg!hhhh"); } }
@Configuration @Import({ CustomerConfig.class, SchedulerConfig.class }) public class AppConfig { }
标签:[] scheduler ann conf rgs java color pre void
原文地址:http://www.cnblogs.com/diaoniwa/p/6480822.html