0
点赞
收藏
分享

微信扫一扫

如何使用postman进行自动化

爪哇驿站 2024-11-03 阅读 2

下载纯真社区库

纯真官网
创建账号,申请免费版本
手动下载ip库,然后复制密钥
在这里插入图片描述

新建maven控制台项目

修改pom.xml引入需要的包

<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.wujialiang</groupId>
        <artifactId>chunzhenstu</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>ipstu01</artifactId>
    <packaging>jar</packaging>

    <name>ipstu01</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.msgpack</groupId>
            <artifactId>msgpack-core</artifactId>
            <version>0.9.8</version>
        </dependency>
        <dependency>
            <groupId>net.cz88</groupId>
            <artifactId>czdb-search</artifactId>
            <version>1.0.2.3</version>
            <scope>system</scope>
            <!--maven仓库中搜索不到-->
            <systemPath>G:/CodeStu/Java/stu06/chunzhenstu/packages/czdb-search-1.0.2.3.jar</systemPath>
        </dependency>
    </dependencies>
</project>

新建resouces文件夹
在这里插入图片描述
将数据库复制到resources文件夹下
在这里插入图片描述
编写代码

package com.wujialiang;

import net.cz88.czdb.DbSearcher;
import net.cz88.czdb.QueryType;

public class App 
{
    public static void main( String[] args )
    {
        try {
            String ipv4Path = App.class.getClass().getResource("/cz88_public_v4.czdb").getPath();
            if(ipv4Path.startsWith("/")){
                ipv4Path = ipv4Path.substring(1);
            }
            DbSearcher searcher = new DbSearcher(ipv4Path, QueryType.MEMORY, "获取的密钥");
            String region = searcher.search("ip地址");
            System.out.println(region);
            searcher.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

在这里插入图片描述

举报

相关推荐

0 条评论