码迷,mamicode.com
首页 > 其他好文 > 详细

sprng 启动

时间:2018-11-17 23:50:48      阅读:372      评论:0      收藏:0      [点我收藏+]

标签:div   final   string   throws   row   sse   out   print   classpath   

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);
        }
    }
}

 

sprng 启动

标签:div   final   string   throws   row   sse   out   print   classpath   

原文地址:https://www.cnblogs.com/xiaolei2017/p/9976308.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!