Skip to content

Commit

Permalink
Merge branch 'springboot3' of https://github.com/dromara/dynamic-tp i…
Browse files Browse the repository at this point in the history
…nto springboot3
  • Loading branch information
yanhom1314 committed Dec 18, 2024
2 parents 6f515f3 + c228531 commit 0496aa5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
21 changes: 21 additions & 0 deletions common/src/main/java/org/dromara/dynamictp/common/em/JreEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/**
* JRE version
*
* @author kamtohung
*/
@Slf4j
Expand Down Expand Up @@ -97,4 +98,24 @@ private static JreEnum getJre() {
return JAVA_8;
}

/**
* 判断当前版本是否大于某个版本
*
* @param targetVersion 目标版本
* @return 是否大于
*/
public static boolean greaterThan(JreEnum targetVersion) {
return getJre().ordinal() > targetVersion.ordinal();
}

/**
* 判断当前版本是否小于某个版本
*
* @param targetVersion 目标版本
* @return 是否小于
*/
public static boolean lessThan(JreEnum targetVersion) {
return getJre().ordinal() < targetVersion.ordinal();
}

}
19 changes: 18 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<packaging>pom</packaging>

<name>DynamicTp Project</name>
<description>🔥🔥🔥轻量级动态线程池,内置监控告警功能,基于主流配置中心(已支持Nacos、Apollo、Zookeeper、Consul、Etcd、Polaris,可通过SPI自定义实现)</description>
<description>
🔥🔥🔥轻量级动态线程池,内置监控告警功能,基于主流配置中心(已支持Nacos、Apollo、Zookeeper、Consul、Etcd、Polaris,可通过SPI自定义实现)
</description>
<url>https://github.com/yanhom1314/dynamic-tp</url>

<properties>
Expand Down Expand Up @@ -254,6 +256,21 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Build-Time>${maven.build.timestamp}</Build-Time>
<Built-By>yanhom</Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,16 @@ void testJRE11() {
Assertions.assertEquals(JreEnum.JAVA_11, JreEnum.currentVersion());
}

@Test
@EnabledOnJre(value = JRE.JAVA_11)
void testJRE11GreaterThan() {
Assertions.assertTrue(JreEnum.greaterThan(JreEnum.JAVA_8));
}

@Test
@EnabledOnJre(value = JRE.JAVA_8)
void testJRE8LessThan() {
Assertions.assertTrue(JreEnum.lessThan(JreEnum.JAVA_11));
}

}

0 comments on commit 0496aa5

Please sign in to comment.