diff --git a/pom.xml b/pom.xml
index 56387c22..ce9b9d00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
com.codingapi.springboot
springboot-parent
- 2.10.20
+ 2.10.21
https://github.com/codingapi/springboot-framewrok
springboot-parent
@@ -235,6 +235,20 @@
-Xlint:deprecation
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ ${maven-jar-plugin.version}
+
+
+
+ ${project.version}
+ ${project.name}
+
+
+
+
diff --git a/springboot-starter-data-authorization/pom.xml b/springboot-starter-data-authorization/pom.xml
index 5edb0924..0ffc5fd7 100644
--- a/springboot-starter-data-authorization/pom.xml
+++ b/springboot-starter-data-authorization/pom.xml
@@ -6,7 +6,7 @@
springboot-parent
com.codingapi.springboot
- 2.10.20
+ 2.10.21
springboot-starter-data-authorization
diff --git a/springboot-starter-data-fast/pom.xml b/springboot-starter-data-fast/pom.xml
index d297d9f7..8d6d3f51 100644
--- a/springboot-starter-data-fast/pom.xml
+++ b/springboot-starter-data-fast/pom.xml
@@ -5,7 +5,7 @@
springboot-parent
com.codingapi.springboot
- 2.10.20
+ 2.10.21
4.0.0
diff --git a/springboot-starter-flow/pom.xml b/springboot-starter-flow/pom.xml
index 66f96160..be8d18df 100644
--- a/springboot-starter-flow/pom.xml
+++ b/springboot-starter-flow/pom.xml
@@ -6,7 +6,7 @@
springboot-parent
com.codingapi.springboot
- 2.10.20
+ 2.10.21
springboot-starter-flow
diff --git a/springboot-starter-security/pom.xml b/springboot-starter-security/pom.xml
index 0230787a..f45583b9 100644
--- a/springboot-starter-security/pom.xml
+++ b/springboot-starter-security/pom.xml
@@ -6,7 +6,7 @@
springboot-parent
com.codingapi.springboot
- 2.10.20
+ 2.10.21
springboot-starter-security
diff --git a/springboot-starter-security/src/test/java/com/codingapi/springboot/security/SecurityJwtApplicationTest.java b/springboot-starter-security/src/test/java/com/codingapi/springboot/security/SecurityJwtApplicationTest.java
index 3872eadc..cd78167b 100644
--- a/springboot-starter-security/src/test/java/com/codingapi/springboot/security/SecurityJwtApplicationTest.java
+++ b/springboot-starter-security/src/test/java/com/codingapi/springboot/security/SecurityJwtApplicationTest.java
@@ -7,14 +7,14 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
+import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.util.StringUtils;
import java.nio.charset.StandardCharsets;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -27,6 +27,20 @@ public class SecurityJwtApplicationTest {
@Autowired
private MockMvc mockMvc;
+
+ @Autowired
+ private PasswordEncoder passwordEncoder;
+
+
+ @Test
+ void encode(){
+ String pwd1 = passwordEncoder.encode("123456");
+ String pwd2 = passwordEncoder.encode("123456");
+ System.out.println(pwd1);
+ System.out.println(pwd2);
+ assertNotEquals(pwd1,pwd2);
+ }
+
@Test
void login() throws Exception {
JSONObject json = new JSONObject();
@@ -37,6 +51,7 @@ void login() throws Exception {
.contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
}
+
@Test
void loginError() throws Exception {
JSONObject json = new JSONObject();
diff --git a/springboot-starter/pom.xml b/springboot-starter/pom.xml
index 8af46c7e..a1ae63cf 100644
--- a/springboot-starter/pom.xml
+++ b/springboot-starter/pom.xml
@@ -5,7 +5,7 @@
com.codingapi.springboot
springboot-parent
- 2.10.20
+ 2.10.21
springboot-starter
diff --git a/springboot-starter/src/main/java/com/codingapi/springboot/framework/AutoConfiguration.java b/springboot-starter/src/main/java/com/codingapi/springboot/framework/AutoConfiguration.java
index 2cfc0ae1..27fbca1c 100644
--- a/springboot-starter/src/main/java/com/codingapi/springboot/framework/AutoConfiguration.java
+++ b/springboot-starter/src/main/java/com/codingapi/springboot/framework/AutoConfiguration.java
@@ -1,8 +1,21 @@
package com.codingapi.springboot.framework;
+import com.codingapi.springboot.framework.utils.VersionUtils;
+import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;
@Configuration
-public class AutoConfiguration {
+public class AutoConfiguration implements InitializingBean {
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ String version = VersionUtils.getDriverVersion();
+ this.printBanner(version);
+ }
+
+ public void printBanner(String version) {
+ System.out.println("------------------------------------------------------");
+ System.out.println("\t\tCodingApi SpringBoot-Starter " + version);
+ System.out.println("------------------------------------------------------");
+ }
}
diff --git a/springboot-starter/src/main/java/com/codingapi/springboot/framework/utils/VersionUtils.java b/springboot-starter/src/main/java/com/codingapi/springboot/framework/utils/VersionUtils.java
new file mode 100644
index 00000000..4c1cedb7
--- /dev/null
+++ b/springboot-starter/src/main/java/com/codingapi/springboot/framework/utils/VersionUtils.java
@@ -0,0 +1,34 @@
+package com.codingapi.springboot.framework.utils;
+
+import java.io.InputStream;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+public class VersionUtils {
+
+ public static String getJarVersion(Class> clazz) {
+ try {
+ String classPath = clazz.getResource(clazz.getSimpleName() + ".class").toString();
+ if (!classPath.startsWith("jar")) {
+ // 不是从 jar 启动的
+ return "DEV";
+ }
+
+ String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
+ try (InputStream inputStream = new java.net.URL(manifestPath).openStream()) {
+ Manifest manifest = new Manifest(inputStream);
+ Attributes attributes = manifest.getMainAttributes();
+ return attributes.getValue("Implementation-Version");
+ }
+ } catch (Exception e) {
+ return "UNKNOWN";
+ }
+ }
+
+
+ public static String getDriverVersion(){
+ return VersionUtils.getJarVersion(VersionUtils.class);
+ }
+
+
+}
diff --git a/springboot-starter/src/main/resources/META-INF/banner.txt b/springboot-starter/src/main/resources/META-INF/banner.txt
deleted file mode 100644
index a047cc68..00000000
--- a/springboot-starter/src/main/resources/META-INF/banner.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-------------------------------------------------------
-CodingApi SpringBoot-Starter 2.10.20
-springboot version (${spring-boot.version})
-------------------------------------------------------