import java.io.IOException;
import java.io.InputStream;
import com.zkw.entity.UserUrl;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class test {
public static void main(String[] args) throws IOException {
/* String resource = "mybatis/conf.xml";
InputStream is = test.class.getClassLoader().getResourceAsStream(resource);
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(is);
SqlSession session = sessionFactory.openSession();
String statement = "urlMapper.getURL";
UserUrl userurl = (UserUrl) session.selectOne(statement, new Integer(1));
System.out.println(userurl.toString());
*/
//=======================================================================
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring/ApplicationContext.xml", "spring/spring-mybatis.xml"});
SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) context.getBean("sqlSessionTemplate", SqlSessionTemplate.class);
UserUrl userUrl = (UserUrl)sqlSessionTemplate.selectOne("urlMapper.getURL", new Integer(1));
System.out.println(userUrl.toString());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
spiderAndAnalysis.rar (44个子文件)
spiderAndAnalysis
spiderAndAnalysis
pom.xml 5KB
target
test-classes
test.class 1KB
m2e-jee
web-resources
META-INF
maven
zkw
spiderAndAnalysis
pom.xml 5KB
pom.properties 271B
MANIFEST.MF 114B
classes
com
zkw
dao
daoimp.class 1KB
controller
login.class 2KB
service
loginService.class 1KB
entity
User.class 723B
UserUrl.class 2KB
spring
spring-mybatis.xml 5KB
ApplicationContext.xml 661B
spring-springMVC.xml 2KB
mybatis
conf.xml 1KB
db.properties 135B
mapper
url.xml 2KB
.settings
com.genuitec.eclipse.j2eedt.core.prefs 56B
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.wst.common.component 630B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 508B
org.eclipse.jdt.core.prefs 430B
src
test
resources
java
test.java 2KB
main
webapp
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 2KB
classes
jsp
index.jsp 879B
lib
index.jsp 52B
resources
spring
spring-mybatis.xml 5KB
ApplicationContext.xml 661B
spring-springMVC.xml 2KB
mybatis
conf.xml 1KB
db.properties 130B
mapper
url.xml 2KB
java
com
zkw
dao
daoimp.java 918B
controller
login.java 1KB
service
loginService.java 617B
entity
User.java 384B
UserUrl.java 2KB
.project 2KB
.mymetadata 358B
.classpath 743B
webdatabase.sql 2KB
共 44 条
- 1
资源评论
TYOUKAI_
- 粉丝: 32
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功