mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
!97 optimize javadoc and code format
Merge pull request !97 from 王帅/main
This commit is contained in:
commit
dd45e14639
@ -1,17 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mybatisflex.solon.integration;
|
||||
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
import org.noear.solon.core.Props;
|
||||
import org.apache.ibatis.solon.MybatisAdapter;
|
||||
import org.apache.ibatis.solon.MybatisAdapterFactory;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
import org.noear.solon.core.Props;
|
||||
|
||||
/**
|
||||
* 适配器工厂 for mybatis-flex
|
||||
* MyBatis-Flex 适配器工厂。
|
||||
*
|
||||
* @author noear
|
||||
* @since 2.2
|
||||
*/
|
||||
public class MybatisAdapterFactoryFlex implements MybatisAdapterFactory {
|
||||
|
||||
@Override
|
||||
public MybatisAdapter create(BeanWrap dsWrap) {
|
||||
return new MybatisAdapterFlex(dsWrap);
|
||||
@ -21,4 +38,5 @@ public class MybatisAdapterFactoryFlex implements MybatisAdapterFactory {
|
||||
public MybatisAdapter create(BeanWrap dsWrap, Props dsProps) {
|
||||
return new MybatisAdapterFlex(dsWrap, dsProps);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mybatisflex.solon.integration;
|
||||
|
||||
import com.mybatisflex.core.FlexGlobalConfig;
|
||||
@ -17,15 +33,19 @@ import org.noear.solon.core.event.EventBus;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 适配器 for mybatis-flex
|
||||
* MyBatis-Flex 适配器。
|
||||
*
|
||||
* @author noear
|
||||
* @since 2.2
|
||||
*/
|
||||
public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
|
||||
FlexSqlSessionFactoryBuilder factoryBuilderPlus;
|
||||
|
||||
FlexGlobalConfig globalConfig;
|
||||
|
||||
RowMapperInvoker rowMapperInvoker;
|
||||
|
||||
protected MybatisAdapterFlex(BeanWrap dsWrap) {
|
||||
super(dsWrap);
|
||||
|
||||
@ -107,25 +127,23 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
return factory;
|
||||
}
|
||||
|
||||
RowMapperInvoker rowMapperInvoker;
|
||||
|
||||
@Override
|
||||
public void injectTo(VarHolder varH) {
|
||||
super.injectTo(varH);
|
||||
|
||||
//@Db("db1") FlexGlobalConfig globalConfig;
|
||||
// @Db("db1") FlexGlobalConfig globalConfig
|
||||
if (FlexGlobalConfig.class.isAssignableFrom(varH.getType())) {
|
||||
varH.setValue(this.getGlobalConfig());
|
||||
return;
|
||||
}
|
||||
|
||||
//@Db("db1") RowMapperInvoker rowMapper;
|
||||
// @Db("db1") RowMapperInvoker rowMapper
|
||||
if (RowMapperInvoker.class.equals(varH.getType())) {
|
||||
if (rowMapperInvoker == null) {
|
||||
rowMapperInvoker = new RowMapperInvoker(getFactory());
|
||||
}
|
||||
varH.setValue(rowMapperInvoker);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mybatisflex.solon.integration;
|
||||
|
||||
import org.apache.ibatis.solon.integration.MybatisAdapterManager;
|
||||
@ -5,15 +21,16 @@ import org.noear.solon.core.AopContext;
|
||||
import org.noear.solon.core.Plugin;
|
||||
|
||||
/**
|
||||
* 配置 MyBatis-Flex 插件。
|
||||
*
|
||||
* @author noear
|
||||
* @since 2.2
|
||||
*/
|
||||
public class XPluginImpl implements Plugin {
|
||||
|
||||
@Override
|
||||
public void start(AopContext context) throws Throwable {
|
||||
//
|
||||
public void start(AopContext context) {
|
||||
// 此插件的 solon.plugin.priority 会大于 mybatis-solon-plugin 的值
|
||||
//
|
||||
MybatisAdapterManager.setAdapterFactory(new MybatisAdapterFactoryFlex());
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MyBatis-Flex Solon 支持。
|
||||
*/
|
||||
package com.mybatisflex.solon.integration;
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,6 +19,12 @@ import com.mybatisflex.core.BaseMapper;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
/**
|
||||
* 默认 {@link IService} 实现类。
|
||||
*
|
||||
* @param <M> Mapper 类型
|
||||
* @param <T> Entity 类型
|
||||
*/
|
||||
public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
|
||||
|
||||
@Inject
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* IService 实现。
|
||||
*/
|
||||
package com.mybatisflex.solon.service.impl;
|
||||
@ -30,7 +30,11 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* <p>判断是否有 MyBatis-Flex 的多数据源配置。
|
||||
*
|
||||
* <p>如果配置文件中有 MyBatis-Flex 的多数据源配置,就加载 MyBatis-Flex 多数据源自动配置类。
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Conditional(ConditionalOnMybatisFlexDatasource.OnMybatisFlexDataSourceCondition.class)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -18,11 +18,16 @@ package com.mybatisflex.spring.boot;
|
||||
import com.mybatisflex.core.mybatis.FlexConfiguration;
|
||||
|
||||
/**
|
||||
* 为 FlexConfiguration 做自定义的配置支持 {@link FlexConfiguration}
|
||||
* 为 {@link FlexConfiguration} 做自定义的配置支持。
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ConfigurationCustomizer {
|
||||
|
||||
/**
|
||||
* 自定义配置 {@link FlexConfiguration}。
|
||||
*
|
||||
* @param configuration MyBatis Flex Configuration
|
||||
*/
|
||||
void customize(FlexConfiguration configuration);
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -26,16 +26,27 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
|
||||
|
||||
/**
|
||||
* MyBatis-Flex 事务自动配置。
|
||||
*/
|
||||
@ConditionalOnClass(Db.class)
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfigureAfter({MybatisFlexAutoConfiguration.class})
|
||||
@AutoConfigureBefore({TransactionAutoConfiguration.class})
|
||||
public class FlexTransactionAutoConfiguration implements TransactionManagementConfigurer {
|
||||
|
||||
/**
|
||||
* 这里使用 final 修饰属性是因为:<br>
|
||||
* <p>
|
||||
* 1、调用 {@link #annotationDrivenTransactionManager} 方法会返回 TransactionManager 对象<br>
|
||||
* 2、{@code @Bean} 注入又会返回 TransactionManager 对象<br>
|
||||
* <p>
|
||||
* 需要保证两个对象的一致性。
|
||||
*/
|
||||
private final FlexTransactionManager flexTransactionManager = new FlexTransactionManager();
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
@Override
|
||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||
return flexTransactionManager;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 多数据源的配置支持
|
||||
* MyBatis-Flex 多数据源的配置支持。
|
||||
*/
|
||||
@ConditionalOnMybatisFlexDatasource()
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ -50,7 +50,6 @@ public class MultiDataSourceAutoConfiguration {
|
||||
dataSourceProperties = properties.getDatasource();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DataSource dataSource() {
|
||||
@ -71,6 +70,9 @@ public class MultiDataSourceAutoConfiguration {
|
||||
return flexDataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link com.mybatisflex.annotation.UseDataSource} 注解切换数据源切面。
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DataSourceAdvice dataSourceAdvice() {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 脚本语言驱动的自动配置,平常一般项目用不到,只为了同步 mybatis 自带的 MybatisLanguageDriverAutoConfiguration
|
||||
* 脚本语言驱动的自动配置,平常一般项目用不到,只为了同步 MyBatis 自带的 MybatisLanguageDriverAutoConfiguration。
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(LanguageDriver.class)
|
||||
@ -56,7 +56,7 @@ public class MybatisLanguageDriverAutoConfiguration {
|
||||
* Configuration class for mybatis-freemarker 1.2.x or above.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ FreeMarkerLanguageDriver.class, FreeMarkerLanguageDriverConfig.class })
|
||||
@ConditionalOnClass({FreeMarkerLanguageDriver.class, FreeMarkerLanguageDriverConfig.class})
|
||||
public static class FreeMarkerConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ -91,7 +91,7 @@ public class MybatisLanguageDriverAutoConfiguration {
|
||||
* Configuration class for mybatis-velocity 2.1.x or above.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ VelocityLanguageDriver.class, VelocityLanguageDriverConfig.class })
|
||||
@ConditionalOnClass({VelocityLanguageDriver.class, VelocityLanguageDriverConfig.class})
|
||||
public static class VelocityConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -31,44 +31,29 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Mybatis 的 VFS 支持
|
||||
* MyBatis 的 VFS 支持。
|
||||
*/
|
||||
public class SpringBootVFS extends VFS {
|
||||
|
||||
private static Charset urlDecodingCharset;
|
||||
private final ResourcePatternResolver resourceResolver;
|
||||
|
||||
static {
|
||||
setUrlDecodingCharset(Charset.defaultCharset());
|
||||
}
|
||||
|
||||
private final ResourcePatternResolver resourceResolver;
|
||||
|
||||
public SpringBootVFS() {
|
||||
this.resourceResolver = new PathMatchingResourcePatternResolver(getClass().getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> list(URL url, String path) throws IOException {
|
||||
String urlString = URLDecoder.decode(url.toString(), urlDecodingCharset.name());
|
||||
String baseUrlString = urlString.endsWith("/") ? urlString : urlString.concat("/");
|
||||
Resource[] resources = resourceResolver.getResources(baseUrlString + "**/*.class");
|
||||
return Stream.of(resources).map(resource -> preserveSubpackageName(baseUrlString, resource, path))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset for decoding an encoded URL string.
|
||||
* <p>
|
||||
* Default is system default charset.
|
||||
* </p>
|
||||
*
|
||||
* @param charset
|
||||
* the charset for decoding an encoded URL string
|
||||
*
|
||||
* @param charset the charset for decoding an encoded URL string
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public static void setUrlDecodingCharset(Charset charset) {
|
||||
@ -86,4 +71,18 @@ public class SpringBootVFS extends VFS {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> list(URL url, String path) throws IOException {
|
||||
String urlString = URLDecoder.decode(url.toString(), urlDecodingCharset.name());
|
||||
String baseUrlString = urlString.endsWith("/") ? urlString : urlString.concat("/");
|
||||
Resource[] resources = resourceResolver.getResources(baseUrlString + "**/*.class");
|
||||
return Stream.of(resources).map(resource -> preserveSubpackageName(baseUrlString, resource, path))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -18,12 +18,18 @@ package com.mybatisflex.spring.boot;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
|
||||
/**
|
||||
* 为 FlexSqlSessionFactoryBean 做自定义的配置支持
|
||||
* 为 FlexSqlSessionFactoryBean 做自定义的配置支持。
|
||||
*
|
||||
* @see com.mybatisflex.spring.FlexSqlSessionFactoryBean
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SqlSessionFactoryBeanCustomizer {
|
||||
|
||||
/**
|
||||
* 自定义 {@link SqlSessionFactoryBean}。
|
||||
*
|
||||
* @param factoryBean FlexSqlSessionFactoryBean
|
||||
*/
|
||||
void customize(SqlSessionFactoryBean factoryBean);
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -13,4 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MyBatis-Flex Spring Boot 支持。
|
||||
*/
|
||||
package com.mybatisflex.spring.boot;
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -73,9 +73,11 @@ import static org.springframework.util.StringUtils.hasLength;
|
||||
import static org.springframework.util.StringUtils.tokenizeToStringArray;
|
||||
|
||||
/**
|
||||
* spring 在定义 SqlSessionFactoryBean 的时候,需要替换为 FlexSqlSessionFactoryBean
|
||||
* 源于 {@link SqlSessionFactoryBean},主要是用于构建 {@link com.mybatisflex.core.mybatis.FlexConfiguration },而不是使用原生的 Configuration
|
||||
* 此代码主要是用于修改 {@link FlexSqlSessionFactoryBean#buildSqlSessionFactory()} 部分
|
||||
* <p>Spring 在定义 SqlSessionFactoryBean 的时候,需要替换为 FlexSqlSessionFactoryBean。
|
||||
*
|
||||
* <p>源于 {@link SqlSessionFactoryBean},主要是用于构建 {@link com.mybatisflex.core.mybatis.FlexConfiguration },而不是使用原生的 {@link Configuration}。
|
||||
*
|
||||
* <p>此代码主要是用于修改 {@link FlexSqlSessionFactoryBean#buildSqlSessionFactory()} 部分。
|
||||
*/
|
||||
public class FlexSqlSessionFactoryBean extends SqlSessionFactoryBean
|
||||
implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ApplicationEvent> {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -23,6 +23,9 @@ import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
|
||||
import org.springframework.transaction.support.DefaultTransactionStatus;
|
||||
|
||||
/**
|
||||
* MyBatis-Flex 事务支持。
|
||||
*/
|
||||
public class FlexTransactionManager extends AbstractPlatformTransactionManager {
|
||||
|
||||
@Override
|
||||
|
||||
@ -36,6 +36,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class DataSourceInterceptor implements MethodInterceptor {
|
||||
|
||||
/**
|
||||
* 缓存方法对应的数据源。
|
||||
*/
|
||||
private final Map<Object, String> dsCache = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
|
||||
@ -57,11 +62,6 @@ public class DataSourceInterceptor implements MethodInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存方法对应的数据源。
|
||||
*/
|
||||
private final Map<Object, String> dsCache = new ConcurrentHashMap<>();
|
||||
|
||||
private String findDataSourceKey(Method method, Class<?> targetClass) {
|
||||
Object cacheKey = new MethodClassKey(method, targetClass);
|
||||
String dsKey = this.dsCache.get(cacheKey);
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 多数据源切面。
|
||||
*/
|
||||
package com.mybatisflex.spring.datasource;
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MyBatis-Flex Spring 支持。
|
||||
*/
|
||||
package com.mybatisflex.spring;
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* IService 实现。
|
||||
*/
|
||||
package com.mybatisflex.spring.service.impl;
|
||||
Loading…
x
Reference in New Issue
Block a user