applicationContext.xml的配置略
一个普通java类
使用spring管理的service和dao正常通过,能输出通过Hibernate查库后结果
黑色头发:http://heisetoufa.iteye.com/
一个普通java类
package com.test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.test.service.ITestService;
import com.test.entity.TestUsers;
public class test {
private ITestService testService ;
public static void main(String[] args) {
BeanFactory factory = new ClassPathXmlApplicationContext("classpath:/applicationContext.xml");
ITestService testService = (ITestService)factory.getBean("test-service");
String result = testService.getCount();
System.out.println("数据库中记录条数:"+result);
}
public IBossPackageService getTestService() {
return testService;
}
public void setTestService(IBossPackageService testService) {
this.testService = testService;
}
}
使用spring管理的service和dao正常通过,能输出通过Hibernate查库后结果
黑色头发:http://heisetoufa.iteye.com/