diff --git a/README.md b/README.md index 97be2ac..6bd464a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Build Status - Coverage Status - Downloads + Coverage Status + Downloads

## SpringBlade微服务开发平台 diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 07092ad..d64f807 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index e47d27f..395dcad 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -60,9 +60,6 @@ spring: #maximum-pool-size: 5 #max-lifetime: 1800000 #minimum-idle: 1 - devtools: - restart: - log-condition-evaluation-delta: false #配置日志地址 @@ -100,7 +97,7 @@ mybatis-plus: swagger: title: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统 - version: 2.6.1 + version: 2.6.2 license: Powered By SpringBlade licenseUrl: https://bladex.vip terms-of-service-url: https://bladex.vip diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index 1caf66a..e2a94e1 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignAutoConfiguration.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignAutoConfiguration.java index 64e6710..9f0315d 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignAutoConfiguration.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignAutoConfiguration.java @@ -55,7 +55,7 @@ import java.util.ArrayList; public class BladeFeignAutoConfiguration { @Bean - @ConditionalOnMissingBean + @ConditionalOnMissingBean(Targeter.class) public Targeter bladeFeignTargeter() { return new BladeHystrixTargeter(); } diff --git a/blade-core-develop/pom.xml b/blade-core-develop/pom.xml index 4fcb08e..83b559f 100644 --- a/blade-core-develop/pom.xml +++ b/blade-core-develop/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index 4d87979..fda2a37 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index a9b63ae..b88f433 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -25,7 +25,7 @@ public interface AppConstant { /** * 应用版本 */ - String APPLICATION_VERSION = "2.6.1"; + String APPLICATION_VERSION = "2.6.2"; /** * 基础包 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index a725c21..6d3e857 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index c25bf52..6be7a34 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-oss/pom.xml b/blade-core-oss/pom.xml index 445c866..d7690ed 100644 --- a/blade-core-oss/pom.xml +++ b/blade-core-oss/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 @@ -27,6 +27,12 @@ qiniu-java-sdk 7.2.18 + + + com.aliyun.oss + aliyun-sdk-oss + 3.1.0 + diff --git a/blade-core-oss/src/main/java/org/springblade/core/oss/AliossTemplate.java b/blade-core-oss/src/main/java/org/springblade/core/oss/AliossTemplate.java new file mode 100644 index 0000000..a063c16 --- /dev/null +++ b/blade-core-oss/src/main/java/org/springblade/core/oss/AliossTemplate.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.oss; + +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.common.utils.BinaryUtil; +import com.aliyun.oss.model.MatchMode; +import com.aliyun.oss.model.ObjectMetadata; +import com.aliyun.oss.model.PolicyConditions; +import com.aliyun.oss.model.PutObjectResult; +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import org.springblade.core.oss.model.BladeFile; +import org.springblade.core.oss.model.OssFile; +import org.springblade.core.oss.props.OssProperties; +import org.springblade.core.oss.rule.OssRule; +import org.springblade.core.tool.jackson.JsonUtil; +import org.springblade.core.tool.utils.StringPool; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * AliossTemplate + * + * @author Chill + */ +@AllArgsConstructor +public class AliossTemplate { + private OSSClient ossClient; + private OssProperties ossProperties; + private OssRule ossRule; + + @SneakyThrows + public void makeBucket(String bucketName) { + if (!bucketExists(bucketName)) { + ossClient.createBucket(getBucketName(bucketName)); + } + } + + @SneakyThrows + public void removeBucket(String bucketName) { + ossClient.deleteBucket(getBucketName(bucketName)); + } + + @SneakyThrows + public boolean bucketExists(String bucketName) { + return ossClient.doesBucketExist(getBucketName(bucketName)); + } + + @SneakyThrows + public void copyFile(String bucketName, String fileName, String destBucketName) { + ossClient.copyObject(getBucketName(bucketName), fileName, getBucketName(destBucketName), fileName); + } + + @SneakyThrows + public void copyFile(String bucketName, String fileName, String destBucketName, String destFileName) { + ossClient.copyObject(getBucketName(bucketName), fileName, getBucketName(destBucketName), destFileName); + } + + @SneakyThrows + public OssFile statFile(String fileName) { + return statFile(ossProperties.getBucketName(), fileName); + } + + @SneakyThrows + public OssFile statFile(String bucketName, String fileName) { + ObjectMetadata stat = ossClient.getObjectMetadata(getBucketName(bucketName), fileName); + OssFile ossFile = new OssFile(); + ossFile.setName(fileName); + ossFile.setLink(fileLink(ossFile.getName())); + ossFile.setHash(stat.getContentMD5()); + ossFile.setLength(stat.getContentLength()); + ossFile.setPutTime(stat.getLastModified()); + ossFile.setContentType(stat.getContentType()); + return ossFile; + } + + @SneakyThrows + public String filePath(String fileName) { + return getOssHost().concat(StringPool.SLASH).concat(fileName); + } + + @SneakyThrows + public String filePath(String bucketName, String fileName) { + return getOssHost(bucketName).concat(StringPool.SLASH).concat(fileName); + } + + @SneakyThrows + public String fileLink(String fileName) { + return getOssHost().concat(StringPool.SLASH).concat(fileName); + } + + @SneakyThrows + public String fileLink(String bucketName, String fileName) { + return getOssHost(bucketName).concat(StringPool.SLASH).concat(fileName); + } + + /** + * 文件对象 + * + * @param file 上传文件类 + * @return + */ + + @SneakyThrows + public BladeFile putFile(MultipartFile file) { + return putFile(ossProperties.getBucketName(), file.getOriginalFilename(), file); + } + + /** + * @param fileName 上传文件名 + * @param file 上传文件类 + * @return + */ + + @SneakyThrows + public BladeFile putFile(String fileName, MultipartFile file) { + return putFile(ossProperties.getBucketName(), fileName, file); + } + + @SneakyThrows + public BladeFile putFile(String bucketName, String fileName, MultipartFile file) { + return putFile(bucketName, fileName, file.getInputStream()); + } + + @SneakyThrows + public BladeFile putFile(String fileName, InputStream stream) { + return putFile(ossProperties.getBucketName(), fileName, stream); + } + + @SneakyThrows + public BladeFile putFile(String bucketName, String fileName, InputStream stream) { + return put(bucketName, stream, fileName, false); + } + + @SneakyThrows + public BladeFile put(String bucketName, InputStream stream, String key, boolean cover) { + makeBucket(bucketName); + String originalName = key; + key = getFileName(key); + // 覆盖上传 + if (cover) { + ossClient.putObject(getBucketName(bucketName), key, stream); + } else { + PutObjectResult response = ossClient.putObject(getBucketName(bucketName), key, stream); + int retry = 0; + int retryCount = 5; + while (StringUtils.isEmpty(response.getETag()) && retry < retryCount) { + response = ossClient.putObject(getBucketName(bucketName), key, stream); + retry++; + } + } + BladeFile file = new BladeFile(); + file.setOriginalName(originalName); + file.setName(key); + file.setLink(fileLink(bucketName, key)); + return file; + } + + @SneakyThrows + public void removeFile(String fileName) { + ossClient.deleteObject(getBucketName(), fileName); + } + + @SneakyThrows + public void removeFile(String bucketName, String fileName) { + ossClient.deleteObject(getBucketName(bucketName), fileName); + } + + @SneakyThrows + public void removeFiles(List fileNames) { + fileNames.forEach(this::removeFile); + } + + @SneakyThrows + public void removeFiles(String bucketName, List fileNames) { + fileNames.forEach(fileName -> removeFile(getBucketName(bucketName), fileName)); + } + + /** + * 根据规则生成存储桶名称规则 + * + * @return String + */ + private String getBucketName() { + return getBucketName(ossProperties.getBucketName()); + } + + /** + * 根据规则生成存储桶名称规则 + * + * @param bucketName 存储桶名称 + * @return String + */ + private String getBucketName(String bucketName) { + return ossRule.bucketName(bucketName); + } + + /** + * 根据规则生成文件名称规则 + * + * @param originalFilename 原始文件名 + * @return string + */ + private String getFileName(String originalFilename) { + return ossRule.fileName(originalFilename); + } + + public String getUploadToken() { + return getUploadToken(ossProperties.getBucketName()); + } + + /** + * TODO 过期时间 + *

+ * 获取上传凭证,普通上传 + */ + public String getUploadToken(String bucketName) { + // 默认过期时间2小时 + return getUploadToken(bucketName, ossProperties.getArgs().get("expireTime", 3600L)); + } + + /** + * TODO 上传大小限制、基础路径 + *

+ * 获取上传凭证,普通上传 + */ + public String getUploadToken(String bucketName, long expireTime) { + String baseDir = "upload"; + + long expireEndTime = System.currentTimeMillis() + expireTime * 1000; + Date expiration = new Date(expireEndTime); + + PolicyConditions policyConds = new PolicyConditions(); + // 默认大小限制10M + policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, ossProperties.getArgs().get("contentLengthRange", 10485760)); + policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, baseDir); + + String postPolicy = ossClient.generatePostPolicy(expiration, policyConds); + byte[] binaryData = postPolicy.getBytes(StandardCharsets.UTF_8); + String encodedPolicy = BinaryUtil.toBase64String(binaryData); + String postSignature = ossClient.calculatePostSignature(postPolicy); + + Map respMap = new LinkedHashMap<>(16); + respMap.put("accessid", ossProperties.getAccessKey()); + respMap.put("policy", encodedPolicy); + respMap.put("signature", postSignature); + respMap.put("dir", baseDir); + respMap.put("host", getOssHost(bucketName)); + respMap.put("expire", String.valueOf(expireEndTime / 1000)); + return JsonUtil.toJson(respMap); + } + + public String getOssHost(String bucketName) { + String prefix = ossProperties.getEndpoint().contains("https://") ? "https://" : "http://"; + return prefix + getBucketName(bucketName) + StringPool.DOT + ossProperties.getEndpoint().replaceFirst(prefix, StringPool.EMPTY); + } + + public String getOssHost() { + return getOssHost(ossProperties.getBucketName()); + } + +} diff --git a/blade-core-oss/src/main/java/org/springblade/core/oss/config/AliossConfiguration.java b/blade-core-oss/src/main/java/org/springblade/core/oss/config/AliossConfiguration.java new file mode 100644 index 0000000..29d3152 --- /dev/null +++ b/blade-core-oss/src/main/java/org/springblade/core/oss/config/AliossConfiguration.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 org.springblade.core.oss.config; + +import com.aliyun.oss.ClientConfiguration; +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.common.auth.CredentialsProvider; +import com.aliyun.oss.common.auth.DefaultCredentialProvider; +import lombok.AllArgsConstructor; +import org.springblade.core.oss.AliossTemplate; +import org.springblade.core.oss.props.OssProperties; +import org.springblade.core.oss.rule.BladeOssRule; +import org.springblade.core.oss.rule.OssRule; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Alioss配置类 + * + * @author Chill + */ +@Configuration +@AllArgsConstructor +@AutoConfigureAfter(QiniuConfiguration.class) +@EnableConfigurationProperties(OssProperties.class) +@ConditionalOnProperty(value = "oss.name", havingValue = "alioss") +public class AliossConfiguration { + + private OssProperties ossProperties; + + @Bean + @ConditionalOnMissingBean(OssRule.class) + public OssRule ossRule() { + return new BladeOssRule(); + } + + @Bean + @ConditionalOnMissingBean(OSSClient.class) + public OSSClient ossClient() { + // 创建ClientConfiguration。ClientConfiguration是OSSClient的配置类,可配置代理、连接超时、最大连接数等参数。 + ClientConfiguration conf = new ClientConfiguration(); + // 设置OSSClient允许打开的最大HTTP连接数,默认为1024个。 + conf.setMaxConnections(1024); + // 设置Socket层传输数据的超时时间,默认为50000毫秒。 + conf.setSocketTimeout(50000); + // 设置建立连接的超时时间,默认为50000毫秒。 + conf.setConnectionTimeout(50000); + // 设置从连接池中获取连接的超时时间(单位:毫秒),默认不超时。 + conf.setConnectionRequestTimeout(1000); + // 设置连接空闲超时时间。超时则关闭连接,默认为60000毫秒。 + conf.setIdleConnectionTime(60000); + // 设置失败请求重试次数,默认为3次。 + conf.setMaxErrorRetry(5); + CredentialsProvider credentialsProvider = new DefaultCredentialProvider(ossProperties.getAccessKey(), ossProperties.getSecretKey()); + return new OSSClient(ossProperties.getEndpoint(), credentialsProvider, conf); + } + + @Bean + @ConditionalOnMissingBean(AliossTemplate.class) + @ConditionalOnBean({OSSClient.class, OssRule.class}) + public AliossTemplate aliossTemplate(OSSClient ossClient, OssRule ossRule) { + return new AliossTemplate(ossClient, ossProperties, ossRule); + } + +} diff --git a/blade-core-oss/src/main/java/org/springblade/core/oss/config/OssConfiguration.java b/blade-core-oss/src/main/java/org/springblade/core/oss/config/QiniuConfiguration.java similarity index 96% rename from blade-core-oss/src/main/java/org/springblade/core/oss/config/OssConfiguration.java rename to blade-core-oss/src/main/java/org/springblade/core/oss/config/QiniuConfiguration.java index c69b614..52ab32a 100644 --- a/blade-core-oss/src/main/java/org/springblade/core/oss/config/OssConfiguration.java +++ b/blade-core-oss/src/main/java/org/springblade/core/oss/config/QiniuConfiguration.java @@ -39,8 +39,8 @@ import org.springframework.context.annotation.Configuration; @Configuration @AllArgsConstructor @EnableConfigurationProperties(OssProperties.class) -@ConditionalOnProperty(value = "oss.enable", havingValue = "true") -public class OssConfiguration { +@ConditionalOnProperty(value = "oss.name", havingValue = "qiniu") +public class QiniuConfiguration { private OssProperties ossProperties; diff --git a/blade-core-oss/src/main/java/org/springblade/core/oss/model/BladeFile.java b/blade-core-oss/src/main/java/org/springblade/core/oss/model/BladeFile.java index bc02327..3b746c7 100644 --- a/blade-core-oss/src/main/java/org/springblade/core/oss/model/BladeFile.java +++ b/blade-core-oss/src/main/java/org/springblade/core/oss/model/BladeFile.java @@ -32,4 +32,8 @@ public class BladeFile { * 文件名 */ private String name; + /** + * 原始文件名 + */ + private String originalName; } diff --git a/blade-core-oss/src/main/java/org/springblade/core/oss/props/OssProperties.java b/blade-core-oss/src/main/java/org/springblade/core/oss/props/OssProperties.java index 1a46887..7b29384 100644 --- a/blade-core-oss/src/main/java/org/springblade/core/oss/props/OssProperties.java +++ b/blade-core-oss/src/main/java/org/springblade/core/oss/props/OssProperties.java @@ -16,6 +16,7 @@ package org.springblade.core.oss.props; import lombok.Data; +import org.springblade.core.tool.support.Kv; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -62,4 +63,9 @@ public class OssProperties { */ private String bucketName = "bladex"; + /** + * 自定义属性 + */ + private Kv args; + } diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index 0e18457..2367341 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index 3e4e62e..4f8da10 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java index 88b245d..b51f6b6 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java @@ -55,7 +55,7 @@ public class SwaggerProperties { /** * 版本 **/ - private String version = "2.6.1"; + private String version = "2.6.2"; /** * 许可证 **/ diff --git a/blade-core-test/pom.xml b/blade-core-test/pom.xml index 738064e..8a67b41 100644 --- a/blade-core-test/pom.xml +++ b/blade-core-test/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index f8e0491..9f433eb 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.6.1 + 2.6.2 4.0.0 diff --git a/blade-core-transaction/pom.xml b/blade-core-transaction/pom.xml index e94897e..058f335 100644 --- a/blade-core-transaction/pom.xml +++ b/blade-core-transaction/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.6.1 + 2.6.2 4.0.0 @@ -31,6 +31,11 @@ spring-cloud-alibaba-seata ${alibaba.cloud.version} + + io.seata + seata-spring-boot-starter + ${alibaba.seata.version} + diff --git a/blade-core-transaction/src/main/java/org/springblade/core/transaction/config/DataSourceConfiguration.java b/blade-core-transaction/src/main/java/org/springblade/core/transaction/config/DataSourceConfiguration.java index a979a3c..2d6424e 100644 --- a/blade-core-transaction/src/main/java/org/springblade/core/transaction/config/DataSourceConfiguration.java +++ b/blade-core-transaction/src/main/java/org/springblade/core/transaction/config/DataSourceConfiguration.java @@ -15,21 +15,7 @@ */ package org.springblade.core.transaction.config; -import com.alibaba.druid.pool.DruidDataSource; -import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; -import io.seata.rm.datasource.DataSourceProxy; -import io.seata.spring.boot.autoconfigure.util.SpringUtils; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; - -import javax.sql.DataSource; /** * 分布式事务数据源配置 @@ -39,48 +25,4 @@ import javax.sql.DataSource; @Configuration public class DataSourceConfiguration { - @Bean(name = "sqlSessionFactory") - public SqlSessionFactory sqlSessionFactoryBean(DataSourceProxy dataSourceProxy) throws Exception { - MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); - bean.setDataSource(dataSourceProxy); - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - bean.setMapperLocations(resolver.getResources("classpath:org/springblade/**/mapper/*Mapper.xml")); - SqlSessionFactory factory; - try { - factory = bean.getObject(); - } catch (Exception e) { - throw new RuntimeException(e); - } - return factory; - } - - @Bean - public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { - return new SqlSessionTemplate(sqlSessionFactory); - } - - /** - * 从配置文件获取属性构造datasource - */ - @Bean - @ConfigurationProperties(prefix = "spring.datasource") - public DruidDataSource druidDataSource() { - return new DruidDataSource(); - } - - /** - * 构造datasource代理对象 - */ - @Primary - @Bean("dataSource") - public DataSourceProxy dataSourceProxy(DataSource druidDataSource) { - return new DataSourceProxy(druidDataSource); - } - - @Bean - @ConditionalOnMissingBean(SpringUtils.class) - public SpringUtils springUtils() { - return new SpringUtils(); - } - } diff --git a/pom.xml b/pom.xml index 7b05a43..8632643 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.6.1 + 2.6.2 pom blade-tool @@ -36,7 +36,7 @@ - 2.6.1 + 2.6.2 1.8 3.8.0 @@ -49,10 +49,10 @@ 2.2.2 1.1.0 2.2.0.RELEASE - 1.0.0 + 1.1.0 - 2.2.4.RELEASE - Hoxton.SR1 + 2.2.5.RELEASE + Hoxton.SR2 Cairo-SR8 UTF-8