🆕 add spring-boot-test
This commit is contained in:
parent
45e09d4e20
commit
513f9e52d6
377
pom.xml
377
pom.xml
|
@ -1,201 +1,208 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>io.github.weihubeats</groupId>
|
<groupId>io.github.weihubeats</groupId>
|
||||||
<artifactId>spring-boot-nebula</artifactId>
|
<artifactId>spring-boot-nebula</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>spring-boot-nebula-web</module>
|
<module>spring-boot-nebula-web</module>
|
||||||
<module>spring-boot-nebula-dependencies</module>
|
<module>spring-boot-nebula-dependencies</module>
|
||||||
<module>spring-boot-nebula-common</module>
|
<module>spring-boot-nebula-common</module>
|
||||||
<module>spring-boot-nebula-samples</module>
|
<module>spring-boot-nebula-samples</module>
|
||||||
<module>spring-boot-nebula-aggregate</module>
|
<module>spring-boot-nebula-aggregate</module>
|
||||||
<module>spring-boot-nebula-mybatis</module>
|
<module>spring-boot-nebula-mybatis</module>
|
||||||
<module>spring-boot-nebula-aop-base</module>
|
<module>spring-boot-nebula-aop-base</module>
|
||||||
<module>spring-boot-nebula-distribute-lock</module>
|
<module>spring-boot-nebula-distribute-lock</module>
|
||||||
<module>spring-boot-nebula-web-common</module>
|
<module>spring-boot-nebula-web-common</module>
|
||||||
<module>spring-boot-nebula-all</module>
|
<module>spring-boot-nebula-all</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<name>spring-boot-nebula</name>
|
<name>spring-boot-nebula</name>
|
||||||
<description>spring-boot-common</description>
|
<description>spring-boot-common</description>
|
||||||
<url>https://github.com/weihubeats/spring-boot-common</url>
|
<url>https://github.com/weihubeats/spring-boot-common</url>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>0.0.01</revision>
|
<revision>0.0.01</revision>
|
||||||
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
|
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
|
||||||
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
|
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.weihubeats</groupId>
|
|
||||||
<artifactId>spring-boot-nebula-dependencies</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>The Apache Software License, Version 2.0</name>
|
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<name>weihubeats</name>
|
|
||||||
<email>weihu@apche.org</email>
|
|
||||||
<organization>https://weihubeats.blog.csdn.net/</organization>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<scm>
|
|
||||||
<connection>scm:git@github.com:weihubeats/spring-boot-common.git</connection>
|
|
||||||
<developerConnection>scm:git@github.com:weihubeats/spring-boot-common.git</developerConnection>
|
|
||||||
<url>git@github.com:weihubeats/spring-boot-common.git</url>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<issueManagement>
|
|
||||||
<system>Github Issue</system>
|
|
||||||
<url>https://github.com/weihubeats/spring-boot-common/issues</url>
|
|
||||||
</issueManagement>
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<dependencies>
|
||||||
<plugins>
|
<dependency>
|
||||||
<plugin>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<scope>test</scope>
|
||||||
<version>3.5.1</version>
|
</dependency>
|
||||||
<inherited>true</inherited>
|
</dependencies>
|
||||||
<configuration>
|
|
||||||
<source>${maven.compiler.source}</source>
|
|
||||||
<target>${maven.compiler.target}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.18.1</version>
|
|
||||||
<inherited>true</inherited>
|
|
||||||
<configuration>
|
|
||||||
<forkCount>1</forkCount>
|
|
||||||
<reuseForks>false</reuseForks>
|
|
||||||
<!-- <skipTests>false</skipTests>-->
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
<configuration>
|
|
||||||
<attach>true</attach>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
|
||||||
<version>3.7.1</version>
|
|
||||||
</plugin>
|
|
||||||
<!-- Javadoc -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<configuration>
|
|
||||||
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
|
|
||||||
<additionalJOptions>
|
|
||||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
|
||||||
</additionalJOptions>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<!-- Gpg Signature -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
<version>${maven-gpg-plugin.version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>sign-artifacts</id>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>sign</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>flatten-maven-plugin</artifactId>
|
|
||||||
<version>${flatten-maven-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<updatePomFile>true</updatePomFile>
|
|
||||||
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>flatten</id>
|
|
||||||
<phase>process-resources</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>flatten</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>flatten.clean</id>
|
|
||||||
<phase>clean</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>clean</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<distributionManagement>
|
<dependencyManagement>
|
||||||
<snapshotRepository>
|
<dependencies>
|
||||||
<id>sonatype</id>
|
<dependency>
|
||||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
<groupId>io.github.weihubeats</groupId>
|
||||||
</snapshotRepository>
|
<artifactId>spring-boot-nebula-dependencies</artifactId>
|
||||||
<repository>
|
<version>${revision}</version>
|
||||||
<id>sonatype</id>
|
<type>pom</type>
|
||||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
<scope>import</scope>
|
||||||
</repository>
|
</dependency>
|
||||||
</distributionManagement>
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>The Apache Software License, Version 2.0</name>
|
||||||
|
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>weihubeats</name>
|
||||||
|
<email>weihu@apche.org</email>
|
||||||
|
<organization>https://weihubeats.blog.csdn.net/</organization>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git@github.com:weihubeats/spring-boot-common.git</connection>
|
||||||
|
<developerConnection>scm:git@github.com:weihubeats/spring-boot-common.git</developerConnection>
|
||||||
|
<url>git@github.com:weihubeats/spring-boot-common.git</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<issueManagement>
|
||||||
|
<system>Github Issue</system>
|
||||||
|
<url>https://github.com/weihubeats/spring-boot-common/issues</url>
|
||||||
|
</issueManagement>
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
<inherited>true</inherited>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.18.1</version>
|
||||||
|
<inherited>true</inherited>
|
||||||
|
<configuration>
|
||||||
|
<forkCount>1</forkCount>
|
||||||
|
<reuseForks>false</reuseForks>
|
||||||
|
<!-- <skipTests>false</skipTests>-->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<attach>true</attach>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>3.7.1</version>
|
||||||
|
</plugin>
|
||||||
|
<!-- Javadoc -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<configuration>
|
||||||
|
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
|
||||||
|
<additionalJOptions>
|
||||||
|
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||||
|
</additionalJOptions>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- Gpg Signature -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>${maven-gpg-plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>flatten-maven-plugin</artifactId>
|
||||||
|
<version>${flatten-maven-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<updatePomFile>true</updatePomFile>
|
||||||
|
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>flatten</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>flatten</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>flatten.clean</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>clean</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -30,6 +30,8 @@
|
||||||
<mybatis-plus-boot-starter.version>3.5.5</mybatis-plus-boot-starter.version>
|
<mybatis-plus-boot-starter.version>3.5.5</mybatis-plus-boot-starter.version>
|
||||||
<redission.version>3.17.3</redission.version>
|
<redission.version>3.17.3</redission.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.nebula.web.common.utils;
|
||||||
import com.nebula.base.utils.DataUtils;
|
import com.nebula.base.utils.DataUtils;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||||
import org.springframework.expression.ExpressionParser;
|
import org.springframework.expression.ExpressionParser;
|
||||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
@ -29,20 +30,20 @@ public class ExpressionUtil {
|
||||||
}
|
}
|
||||||
//获取被拦截方法参数名列表
|
//获取被拦截方法参数名列表
|
||||||
LocalVariableTableParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer();
|
LocalVariableTableParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer();
|
||||||
String[] paramNameArr = discoverer.getParameterNames(method);
|
String[] paramNames = discoverer.getParameterNames(method);
|
||||||
|
if (paramNames == null || args == null || paramNames.length != args.length) {
|
||||||
|
throw new IllegalArgumentException("Method parameter names and argument values do not match.");
|
||||||
|
}
|
||||||
//SPEL解析
|
//SPEL解析
|
||||||
ExpressionParser parser = new SpelExpressionParser();
|
ExpressionParser parser = new SpelExpressionParser();
|
||||||
StandardEvaluationContext context = new StandardEvaluationContext();
|
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
for (int i = 0; i < Objects.requireNonNull(paramNameArr).length; i++) {
|
for (int i = 0; i < Objects.requireNonNull(paramNames).length; i++) {
|
||||||
context.setVariable(paramNameArr[i], args[i]);
|
context.setVariable(paramNames[i], args[i]);
|
||||||
}
|
}
|
||||||
return parser.parseExpression(expressionString).getValue(context);
|
return parser.parseExpression(expressionString).getValue(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEl(String param) {
|
public static boolean isEl(String param) {
|
||||||
if (DataUtils.isEmpty(param)) {
|
return !StringUtils.isEmpty(param) && param.startsWith("#");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(param.substring(0, 1), "#");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.nebula.web.common.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : wh
|
||||||
|
* @date : 2024/6/1 22:12
|
||||||
|
* @description:
|
||||||
|
*/
|
||||||
|
public class ExpressionUtilTest {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -28,12 +28,7 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
Loading…
Reference in New Issue