Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ name: CI

on:
push:
branches: [2.3.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, 3.5.x, 4.0.x, 4.1.x]
branches: [main, 'test/*', 2.3.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, 3.5.x, 4.0.x, 4.1.x]
pull_request:
branches: [2.3.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, 3.5.x, 4.0.x, 4.1.x]
branches: [main, 'test/*', 2.3.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, 3.5.x, 4.0.x, 4.1.x]

permissions:
contents: read

jobs:
build:
uses: easy-4-java/.github/.github/workflows/maven-starter-ci.yml@main
with:
version-line: ${{ (github.base_ref == 'main' || startsWith(github.base_ref, 'test/') || github.ref_name == 'main' || startsWith(github.ref_name, 'test/')) && '2.7.x' || github.base_ref || github.ref_name }}
secrets: inherit
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

---

> **Current Version**:`2.0.2-SNAPSHOT`<br>
> **Current Version**:`2.0.x.20260630-SNAPSHOT`<br>
> **JDK Baseline**:`17`<br>
> **Group ID**:`io.github.easy4j`<br>
> **Artifact ID**:`ip2region-spring-boot-starter`<br>
Expand All @@ -37,7 +37,7 @@
| Consumers | Spring Boot applications using ip2region |
| Core Capabilities | auto-configuration, property binding, ready-to-use beans for ip2region |
| JDK | `17` |
| Coordinates | `io.github.easy4j:ip2region-spring-boot-starter:2.0.2-SNAPSHOT` |
| Coordinates | `io.github.easy4j:ip2region-spring-boot-starter:2.0.x.20260630-SNAPSHOT` |
| Config Prefix | `ip2region` |

## 2. Core Capabilities
Expand Down Expand Up @@ -76,7 +76,7 @@ Auto-configuration registration:
<dependency>
<groupId>io.github.easy4j</groupId>
<artifactId>ip2region-spring-boot-starter</artifactId>
<version>2.0.2-SNAPSHOT</version>
<version>2.0.x.20260630-SNAPSHOT</version>
</dependency>
```

Expand Down
6 changes: 3 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

---

> **当前版本**:`2.0.2-SNAPSHOT`<br>
> **当前版本**:`2.0.x.20260630-SNAPSHOT`<br>
> **JDK 基线**:`17`<br>
> **Group ID**:`io.github.easy4j`<br>
> **Artifact ID**:`ip2region-spring-boot-starter`<br>
Expand All @@ -37,7 +37,7 @@
| 消费方 | 使用 ip2region 的 Spring Boot 应用 |
| 核心能力 | 自动装配、属性绑定、开箱即用的 ip2region Bean |
| JDK | `17` |
| 坐标 | `io.github.easy4j:ip2region-spring-boot-starter:2.0.2-SNAPSHOT` |
| 坐标 | `io.github.easy4j:ip2region-spring-boot-starter:2.0.x.20260630-SNAPSHOT` |
| 配置前缀 | `ip2region` |

## 2. 核心能力
Expand Down Expand Up @@ -76,7 +76,7 @@ Starter 自动装配以下 Bean:
<dependency>
<groupId>io.github.easy4j</groupId>
<artifactId>ip2region-spring-boot-starter</artifactId>
<version>2.0.2-SNAPSHOT</version>
<version>2.0.x.20260630-SNAPSHOT</version>
</dependency>
```

Expand Down
14 changes: 9 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.15</version>
<version>2.7.18</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>io.github.easy4j</groupId>
<artifactId>ip2region-spring-boot-starter</artifactId>
<description>Spring Boot Starter For ip2region</description>
<version>2.0.2-SNAPSHOT</version>
<version>2.0.x.20260630-SNAPSHOT</version>
<name>${project.groupId}:${project.artifactId}</name>
<url>https://github.com/easy-4-java/${project.artifactId}</url>
<packaging>jar</packaging>
Expand Down Expand Up @@ -164,9 +164,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!-- 跳过单元测试 -->
<skip>true</skip>
<skipTests>true</skipTests>
<skip>false</skip>
<skipTests>false</skipTests>
<!-- forkMode 可设置值有 “never”, “once”, “always” 和 “pertest”。 pretest:
每一个测试创建一个新进程,为每个测试创建新的JVM是单独测试的最彻底方式,但也是最慢的,不适合hudson上持续回归。 once:在一个进程中进行所有测试。once为默认设置,在Hudson上持续回归时建议使用默认设置。
always:在一个进程中并行的运行脚本,Junit4.7以上版本才可以使用,surefire的版本要在2.6以上提供这个功能,其中 threadCount:执行时,指定可分配的线程数量。只和参数parallel配合使用有效。默认:5。 -->
Expand Down Expand Up @@ -412,6 +411,11 @@
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
<maven-nexus-staging-plugin.version>1.6.8</maven-nexus-staging-plugin.version>
<ip2region.version>2.7.0</ip2region.version>
<spring-framework.version>5.3.39</spring-framework.version>
<snakeyaml.version>2.7</snakeyaml.version>
<json-path.version>2.9.0</json-path.version>
<assertj.version>3.27.7</assertj.version>
<xmlunit2.version>2.10.0</xmlunit2.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
import io.github.easy4j.ip2region.spring.boot.ext.RegionAddress;
import io.github.easy4j.ip2region.spring.boot.ext.RegionEnum;
import io.github.easy4j.ip2region.spring.boot.ext.XdbSearcher;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.test.context.event.annotation.BeforeTestMethod;
import org.springframework.core.io.DefaultResourceLoader;

import static org.assertj.core.api.Assertions.assertThat;

public class IP2RegionTemplate_Test {

IP2regionTemplate template = null;

@BeforeTestMethod
@BeforeEach
public void setUp() throws Exception {
String dbPath = "D:\\data\\ip2region.xdb";
XdbSearcher xdbSearcher = new XdbSearcher(null, dbPath);
XdbSearcher xdbSearcher = new XdbSearcher(new DefaultResourceLoader(), XdbSearcher.DEFAULT_LOCATION);
template = new IP2regionTemplate(xdbSearcher);
}

@Test
public void templateTest() throws Exception {
assertThat(template.getRegion("8.8.8.8")).isEqualTo("美国|0|0|0|Level3");

System.out.println(template.memorySearch("127.0.0.1"));
System.out.println(template.memorySearch("114.124.146.103"));
Expand Down
Loading