package com.csf.rml; import com.csf.rml.controller.MuserController; import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; import java.io.File; /** * Create by mafenglei on 2018/8/7. 22:22 */ public class StartMain { public static final Logger logegr = Logger.getLogger(StartMain.class); public static void main(String[] args) throws Exception { System.out.println("============== start =============="); // spring的初始化 方式一 String[] path = new String[]{"classpath:/spring/applicationContext-*.xml"}; FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(path); MuserController mc = (MuserController) context.getBean("muserController"); // spring的初始化 方式二 // ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext-*.xml"); // MuserController mc = (MuserController) applicationContext.getBean("muserController"); logegr.info("Server started"); logegr.info(mc + "\r\n"); logegr.info(mc.testPath(null, null) + "\r\n"); logegr.info(mc.listUser(null, null) + "\r\n"); while (Boolean.TRUE) { Thread.sleep(100000); } } }
原文地址:https://www.cnblogs.com/xiaolei2017/p/9976308.html
时间: 2024-10-13 11:14:05