请教使用mybatis用到的注解方式转换为xml配置方式

sj2love0qh 2012-02-23 02:55:35
使用mybatis拦截分页时用的一个拦截器
这是xml文件中配置的

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="plugins" ref="paginationInterceptor"/>
</bean>
<bean id="paginationInterceptor" class="**.PaginationInterceptor" />

以下是PaginationInterceptor类

//只拦截select部分
@Intercepts( {@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class,
RowBounds.class, ResultHandler.class})})
public class PaginationInterceptor implements Interceptor {

public Object intercept(Invocation invocation) throws Throwable {
……
……
}
}


注解部分
@Intercepts( {@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class,
RowBounds.class, ResultHandler.class})})
如果不用注解方式,直接在xml里配置,该怎么写呢?
...全文
494 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
beiouwolf 2012-02-23
  • 打赏
  • 举报
回复
这个拦截器操作的是plugin
这本身就是MyBatis的底层实现,这部分没有xml
重写了plugin就意味着,你改变了MyBatis本身的执行逻辑
qq737604771 2012-02-23
  • 打赏
  • 举报
回复

<bean id="ServiceAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="proxyTargetClass" value="true"></property>
<property name="beanNames">
<list>
<value>*Service</value> ..
</list>
</property>
</bean>
sj2love0qh 2012-02-23
  • 打赏
  • 举报
回复
是spring的拦截器。是在使用mybatis时用到的。说明一下用途吧。
怎么转成xml中配置呢?
beiouwolf 2012-02-23
  • 打赏
  • 举报
回复
你这个和MyBatis就没多大关系...这不是Spring的拦截器吗...
sj2love0qh 2012-02-23
  • 打赏
  • 举报
回复
来高人解答一下啊

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧