sprng 启动

Posted xiaolei2017

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sprng 启动相关的知识,希望对你有一定的参考价值。

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 + "
");

        logegr.info(mc.testPath(null, null) + "
");

        logegr.info(mc.listUser(null, null) + "
");

        while (Boolean.TRUE) {
            Thread.sleep(100000);
        }
    }
}

 

以上是关于sprng 启动的主要内容,如果未能解决你的问题,请参考以下文章

sprng boot 怎么自定义响应的html页面

Sprng Data JPA与hibernate的关系

Android小部件,启动一个片段?

scrapy按顺序启动多个爬虫代码片段(python3)

linux打开终端如何启动scala,如何在终端下运行Scala代码片段?

十个html5代码片段,超实用,一定要收藏