SpringContextTest.java 1.01 KB
package com.cjs.cms.biz;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.cjs.cms.biz.user.point.PointActiveBiz;
import com.cjs.cms.util.lang.SpringContextUtil;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/applicationContext.xml")
public class SpringContextTest {

    @Autowired
    private PointActiveBiz point;
    Logger                 log = LogManager.getLogger();

    @Test
    public void test() {
        System.out.println(point.searchById(3));
        try {
            Class clz = Class.forName("com.cjs.cms.biz.user.ActiveBiz");
            Object obj = SpringContextUtil.getBean(clz);
        } catch (ClassNotFoundException e) {
            log.info(e.getMessage());
        }
    }
}