eclipse中怎么在代码中快速链接到mybatis的xml文件

eclipse中怎么在代码中快速链接到mybatis的xml文件,第1张

快速链接到配置文件需要一个插件,名字是MyBatipse : Eclipse plugin for MyBatis。

下面是下载地址:github: >

你也可以在eclipse上搜索安装:

点击eclipse的help

选择Eclipse Marketplace

搜索下载安装。

我把mybatis32的源码下载之后,把里面PooledDataSource类的log输出部分,换成logwarn之后,重新打jar包,放到项目中,日志级别改为info,如:
Java代码
log4jrootLogger=info, stdout, R
log4jappenderstdout=orgapachelog4jConsoleAppender
log4jappenderstdoutlayout=orgapachelog4jPatternLayout
log4jappenderstdoutlayoutConversionPattern=[service] %d - %c -%-4r [%t] %-5p %c %x - %m%n
log4jappenderR=orgapachelog4jDailyRollingFileAppender
log4jappenderRFile=/logs/servicelog
log4jappenderRlayout=orgapachelog4jPatternLayout
log4jappenderRlayoutConversionPattern=[service] %d - %c -%-4r [%t] %-5p %c %x - %m%n
log4jloggercomibatis = debug
log4jloggercomibatiscommonjdbcSimpleDataSource = debug
log4jloggercomibatiscommonjdbcScriptRunner = debug
log4jloggercomibatissqlmapengineimplSqlMapClientDelegate = debug
log4jloggerjavasqlConnection = debug
log4jloggerjavasqlStatement = debug
log4jloggerjavasqlPreparedStatement = debug
log4jloggerjavasqlResultSet =debug
此时,info级别能够输出warn级别的日志,我的日志显示如下:
Java代码
[service] 2013-04-19 10:30:57,982 - orgapacheibatisdatasourcepooledPooledDataSource -0 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - PooledDataSource forcefully closed/removed all connections
[service] 2013-04-19 10:30:57,985 - orgapacheibatisdatasourcepooledPooledDataSource -3 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - PooledDataSource forcefully closed/removed all connections
[service] 2013-04-19 10:30:57,986 - orgapacheibatisdatasourcepooledPooledDataSource -4 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - PooledDataSource forcefully closed/removed all connections
[service] 2013-04-19 10:30:57,996 - orgapacheibatisdatasourcepooledPooledDataSource -14 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - PooledDataSource forcefully closed/removed all connections
[service] 2013-04-19 10:30:59,025 - orgapacheibatisdatasourcepooledPooledDataSource -1043 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - Created connection 22323092
[service] 2013-04-19 10:30:59,076 - orgapacheibatisdatasourcepooledPooledDataSource -1094 [main] WARN orgapacheibatisdatasourcepooledPooledDataSource - Returned connection 22323092 to pool
很明显,这是显示warn的日志信息了。说明mybatis3只是打印了debug级别的日志。

下载插件
mybatis 插件地址:>工具是Myeclipse10和mybatis-generator-core-131,数据库是oracle 1下载mybatis-generator-core-131-bundle,导入mybatis-generator-core-131jar和myeclipse311jar 2编写生成器的配置文件generatorConfigxml

如果你是java项目,我是直接创建一个lib文件夹,然后把所有要用的包复制放在这里,然后全选所有的包,右键,bulid path

如果是web项目,直接放在lib文件夹就可以了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13398589.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-28
下一篇 2023-07-28

发表评论

登录后才能评论

评论列表(0条)

保存