Skip to content

Instantly share code, notes, and snippets.

@qsLI
qsLI / MapperTest.java
Created August 13, 2018 04:26
test mybatis mapper
@Test
public void countExpiredUser() throws IllegalAccessException {
final Field mappedStatements = ReflectionUtils.findField(Configuration.class, "mappedStatements");
mappedStatements.setAccessible(true);
final Map<String, MappedStatement> stringMappedStatementMap =
(Map<String, MappedStatement>)mappedStatements.get(config);
stringMappedStatementMap.forEach(
(k, v) -> {
if (StringUtils.isNotBlank(k) && k.startsWith(namespace)) {
final SqlSource sqlSource = v.getSqlSource();
@qsLI
qsLI / spring-mvc.xml
Created August 7, 2018 07:30
exclude-filter
<context:component-scan base-package="com.atour">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Service" />
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Repository" />
</context:component-scan>
Collection<?> additionalFilters = args == null
? Collections.emptyList()
: args.additionalFilters;
@qsLI
qsLI / directmemory.jsp
Created June 6, 2018 03:54
get directmemory usage
<%@ page import="java.lang.management.BufferPoolMXBean" %>
<%@ page import="java.util.List" %>
<%@ page import="java.lang.management.ManagementFactory" %><%--
Created by IntelliJ IDEA.
User: qishengli
Date: 18-6-6
Time: 上午11:40
To change this template use File | Settings | File Templates.
--%>
<%
package com.qunar.mobile.dao.order.hotel.impl;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.ibatis.builder.annotation.ProviderSqlSource;
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.scripting.xmltags.DynamicSqlSource;
@qsLI
qsLI / allUrls.jsp
Created May 5, 2018 10:48
print all urls in spring mvc
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.util.MultiValueMap" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.web.method.HandlerMethod" %>
<%@ page import="org.springframework.web.servlet.handler.AbstractHandlerMethodMapping" %>
<%@ page import="org.springframework.web.servlet.mvc.method.RequestMappingInfo" %>
<%@ page import="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" %>
<%@ page import="java.lang.reflect.Field" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
package com.air.nio;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
@qsLI
qsLI / GenericFilter.java
Created March 16, 2018 07:21
泛化调用provider端实现
/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@qsLI
qsLI / GenericImplFilter.java
Last active March 16, 2018 07:18
泛化调用consumer端的实现逻辑
/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@qsLI
qsLI / introrx.md
Created February 12, 2018 08:24 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing