diff --git a/eladmin-common/pom.xml b/eladmin-common/pom.xml index 2150b4b7..a349edd4 100644 --- a/eladmin-common/pom.xml +++ b/eladmin-common/pom.xml @@ -9,7 +9,7 @@ 4.0.0 - 5.3.4 + 5.7.22 eladmin-common diff --git a/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java index 50343bcb..6d267746 100644 --- a/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java +++ b/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java @@ -15,8 +15,8 @@ */ package me.zhengjie.config; +import cn.hutool.core.collection.CollUtil; import com.fasterxml.classmate.TypeResolver; -import com.google.common.base.Predicates; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -29,14 +29,18 @@ import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.schema.AlternateTypeRule; import springfox.documentation.schema.AlternateTypeRuleConvention; -import springfox.documentation.service.*; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; + import java.util.ArrayList; import java.util.List; -import static com.google.common.collect.Lists.newArrayList; import static springfox.documentation.schema.AlternateTypeRules.newRule; /** @@ -62,7 +66,7 @@ public class SwaggerConfig { .pathMapping("/") .apiInfo(apiInfo()) .select() - .paths(Predicates.not(PathSelectors.regex("/error.*"))) + .paths(PathSelectors.regex("^(?!/error).*")) .paths(PathSelectors.any()) .build() //添加登陆认证 @@ -98,7 +102,7 @@ public class SwaggerConfig { private SecurityContext getContextByPath() { return SecurityContext.builder() .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!/auth).*$")) + .operationSelector(o->o.requestMappingPattern().matches("^(?!/auth).*$")) .build(); } @@ -128,7 +132,7 @@ class SwaggerDataConfig { @Override public List rules() { - return newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class))); + return CollUtil.newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class))); } }; } diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/ValidationUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/ValidationUtil.java index 57a4913d..e561762b 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/ValidationUtil.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/ValidationUtil.java @@ -15,16 +15,17 @@ */ package me.zhengjie.utils; +import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjectUtil; import me.zhengjie.exception.BadRequestException; -import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; /** * 验证工具 + * * @author Zheng Jie * @date 2018-11-23 */ -public class ValidationUtil{ +public class ValidationUtil { /** * 验证空 @@ -36,10 +37,10 @@ public class ValidationUtil{ } } - /** - * 验证是否为邮箱 - */ - public static boolean isEmail(String email) { - return new EmailValidator().isValid(email, null); - } + /** + * 验证是否为邮箱 + */ + public static boolean isEmail(String email) { + return Validator.isEmail(email); + } } diff --git a/eladmin-common/src/test/java/me/zhengjie/utils/DateUtilsTest.java b/eladmin-common/src/test/java/me/zhengjie/utils/DateUtilsTest.java index 4f28ed37..dfe01e09 100644 --- a/eladmin-common/src/test/java/me/zhengjie/utils/DateUtilsTest.java +++ b/eladmin-common/src/test/java/me/zhengjie/utils/DateUtilsTest.java @@ -1,6 +1,6 @@ package me.zhengjie.utils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.time.LocalDateTime; import java.util.Date; diff --git a/eladmin-common/src/test/java/me/zhengjie/utils/EncryptUtilsTest.java b/eladmin-common/src/test/java/me/zhengjie/utils/EncryptUtilsTest.java index f909d9db..3ec73752 100644 --- a/eladmin-common/src/test/java/me/zhengjie/utils/EncryptUtilsTest.java +++ b/eladmin-common/src/test/java/me/zhengjie/utils/EncryptUtilsTest.java @@ -1,8 +1,9 @@ package me.zhengjie.utils; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; + import static me.zhengjie.utils.EncryptUtils.*; +import static org.junit.jupiter.api.Assertions.assertEquals; public class EncryptUtilsTest { diff --git a/eladmin-common/src/test/java/me/zhengjie/utils/FileUtilTest.java b/eladmin-common/src/test/java/me/zhengjie/utils/FileUtilTest.java index f069c158..48e06bd7 100644 --- a/eladmin-common/src/test/java/me/zhengjie/utils/FileUtilTest.java +++ b/eladmin-common/src/test/java/me/zhengjie/utils/FileUtilTest.java @@ -1,10 +1,10 @@ package me.zhengjie.utils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockMultipartFile; -import static org.junit.Assert.*; import static me.zhengjie.utils.FileUtil.*; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FileUtilTest { diff --git a/eladmin-common/src/test/java/me/zhengjie/utils/StringUtilsTest.java b/eladmin-common/src/test/java/me/zhengjie/utils/StringUtilsTest.java index 12e875a8..ffb2cf88 100644 --- a/eladmin-common/src/test/java/me/zhengjie/utils/StringUtilsTest.java +++ b/eladmin-common/src/test/java/me/zhengjie/utils/StringUtilsTest.java @@ -1,13 +1,18 @@ package me.zhengjie.utils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Date; -import static me.zhengjie.utils.StringUtils.*; -import static org.junit.Assert.*; +import static me.zhengjie.utils.StringUtils.getIp; +import static me.zhengjie.utils.StringUtils.getWeekDay; +import static me.zhengjie.utils.StringUtils.toCamelCase; +import static me.zhengjie.utils.StringUtils.toCapitalizeCamelCase; +import static me.zhengjie.utils.StringUtils.toUnderScoreCase; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class StringUtilsTest { @@ -40,4 +45,4 @@ public class StringUtilsTest { public void testGetIP() { assertEquals("127.0.0.1", getIp(new MockHttpServletRequest())); } -} \ No newline at end of file +} diff --git a/eladmin-generator/pom.xml b/eladmin-generator/pom.xml index 52cdcfbe..96089616 100644 --- a/eladmin-generator/pom.xml +++ b/eladmin-generator/pom.xml @@ -13,7 +13,7 @@ 代码生成模块 - 1.9 + 1.10 diff --git a/eladmin-system/pom.xml b/eladmin-system/pom.xml index 46d81786..fc36c5c5 100644 --- a/eladmin-system/pom.xml +++ b/eladmin-system/pom.xml @@ -13,7 +13,7 @@ 核心模块 - 0.11.1 + 0.11.2 5.8.0 @@ -84,7 +84,7 @@ com.github.oshi oshi-core - 5.7.1 + 6.1.4 diff --git a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java index dca5b94b..a0093d68 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java @@ -54,7 +54,7 @@ public class ConfigurerAdapter implements WebMvcConfigurer { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); - config.addAllowedOrigin("*"); + config.addAllowedOriginPattern("*"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); source.registerCorsConfiguration("/**", config); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java index ccdb4c9e..9825662b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java @@ -15,9 +15,8 @@ */ package me.zhengjie.modules.system.service.impl; -import cn.hutool.core.date.BetweenFormater; +import cn.hutool.core.date.BetweenFormatter.Level; import cn.hutool.core.date.DateUtil; -import me.zhengjie.exception.BadRequestException; import me.zhengjie.modules.system.service.MonitorService; import me.zhengjie.utils.ElAdminConstant; import me.zhengjie.utils.FileUtil; @@ -177,7 +176,7 @@ public class MonitorServiceImpl implements MonitorService { long time = ManagementFactory.getRuntimeMXBean().getStartTime(); Date date = new Date(time); // 计算项目运行时间 - String formatBetween = DateUtil.formatBetween(date, new Date(),BetweenFormater.Level.HOUR); + String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); // 系统信息 systemInfo.put("os", os.toString()); systemInfo.put("day", formatBetween); diff --git a/eladmin-system/src/main/resources/banner.txt b/eladmin-system/src/main/resources/banner.txt index fc2a4370..cc460ce3 100644 --- a/eladmin-system/src/main/resources/banner.txt +++ b/eladmin-system/src/main/resources/banner.txt @@ -5,4 +5,4 @@ | __| | | (_| | (_| | | | | | | | | | | \___|_| \__,_|\__,_|_| |_| |_|_|_| |_| - :: Spring Boot :: (v2.2.10.RELEASE) \ No newline at end of file + :: Spring Boot :: (v2.6.4) \ No newline at end of file diff --git a/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl b/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl index 9d8b1e71..c5cf9c26 100644 --- a/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl +++ b/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl @@ -55,7 +55,7 @@ public class ${className} implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) + @Column(name = "`${column.columnName}`"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) <#if column.istNotNull && column.columnKey != 'PRI'> <#if column.columnType = 'String'> @NotBlank @@ -82,4 +82,4 @@ public class ${className} implements Serializable { public void copy(${className} source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } -} \ No newline at end of file +} diff --git a/eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java b/eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java index 45d52120..d3986f0f 100644 --- a/eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java +++ b/eladmin-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java @@ -1,11 +1,8 @@ package me.zhengjie; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class EladminSystemApplicationTests { diff --git a/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java b/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java deleted file mode 100644 index 4cae4a8f..00000000 --- a/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package me.zhengjie; - -import me.zhengjie.modules.security.service.UserDetailsServiceImpl; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.annotation.Resource; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class LoginCacheTest { - - @Resource(name = "userDetailsService") - private UserDetailsServiceImpl userDetailsService; - ExecutorService executor = Executors.newCachedThreadPool(); - - @Test - public void testCache() throws InterruptedException { - long start1 = System.currentTimeMillis(); - int size = 1000; - CountDownLatch latch = new CountDownLatch(size); - for (int i = 0; i < size; i++) { - executor.submit(() -> userDetailsService.loadUserByUsername("admin")); - latch.countDown(); - } - latch.await(); - - long end1 = System.currentTimeMillis(); - //关闭缓存 - userDetailsService.setEnableCache(false); - long start2 = System.currentTimeMillis(); - for (int i = 0; i < size; i++) { - userDetailsService.loadUserByUsername("admin"); - } - long end2 = System.currentTimeMillis(); - System.out.print("使用缓存:" + (end1 - start1) + "毫秒\n 不使用缓存:" + (end2 - start2) + "毫秒"); - } - - @Test - public void testCacheManager() throws InterruptedException { - int size = 1000; - CountDownLatch latch = new CountDownLatch(size); - for (int i = 0; i < size; i++) { - int mod = i % 10; - executor.submit(() -> { - try { - Thread.sleep(mod * 2 + (int) (Math.random() * 10000)); - } catch (InterruptedException e) { - e.printStackTrace(); - } - userDetailsService.loadUserByUsername("admin" + mod); - latch.countDown(); - System.out.println("剩余未完成数量" + latch.getCount()); - }); - } - latch.await(); - } - -} diff --git a/eladmin-tools/pom.xml b/eladmin-tools/pom.xml index 4bbf9f4c..dbf5e63b 100644 --- a/eladmin-tools/pom.xml +++ b/eladmin-tools/pom.xml @@ -14,8 +14,8 @@ 1.4.7 - [7.2.0, 7.2.99] - 4.9.153.ALL + 7.9.3 + 4.22.57.ALL @@ -47,4 +47,4 @@ ${alipay.version} - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 1f64d700..14bf38dc 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.10.RELEASE + 2.6.4 @@ -35,9 +35,9 @@ 1.16 2.9.2 1.2.83 - 1.1.24 - 2.5.0 - 1.3.1.Final + 1.2.8 + 2.11.1 + 1.4.2.Final @@ -80,6 +80,7 @@ + org.apache.commons commons-pool2 @@ -98,37 +99,14 @@ + - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - io.swagger - swagger-annotations - 1.5.21 - - - io.swagger - swagger-models - 1.5.21 + com.github.xiaoymin + knife4j-spring-boot-starter + 3.0.3 + mysql @@ -144,13 +122,13 @@ + net.dreamlu mica-ip2region - 2.5.6 + 2.6.3 - org.projectlombok @@ -162,12 +140,12 @@ org.apache.poi poi - 3.17 + 5.2.0 org.apache.poi poi-ooxml - 3.17 + 5.2.0 xerces @@ -211,7 +189,7 @@ nl.basjes.parse.useragent yauaa - 5.23 + 6.11