81,091
社区成员
发帖
与我相关
我的任务
分享
package com.test.tianhang.junt_test;
import java.util.List;
import org.jtester.module.spring.annotations.SpringBeanByName;
import org.junit.Test;
import org.unitils.spring.annotation.SpringApplicationContext;
@SpringApplicationContext({"spring/spring-context.xml"})
public class mbtest {
@SpringBeanByName
private SwitchConfig swit;
@Test
public void test1(){
System.out.println(":1");
}
}
<?xml version="1.0" encoding="GBK"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
default-autowire="byName">
<bean id="switchConfig" class="com.test.datastation.common.constants.SwitchConfig" init-method="init"/>
</beans>