mica 2.0.1 发布,新增最好用的 ip2region boot stater

栏目: 软件资讯 · 发布时间: 5年前

内容简介:mica(云母) mica 由如梦技术内部的 lutool(撸秃)演变而来。lutool 诞生于 2017 年,受 jhipster 启发逐步形成一个微服务的核心集。 因 lutool 名称与功能不太符合,故在2019年开源时将其改名为 mica(云母),...

mica(云母)

mica 由如梦技术内部的 lutool(撸秃)演变而来。lutool 诞生于 2017 年,受 jhipster 启发逐步形成一个微服务的核心集。

因 lutool 名称与功能不太符合,故在2019年开源时将其改名为 mica(云母),寓意为云服务的基石。

mica 2.x核心依赖

mica 基于 java 8,没有历史包袱,支持传统 Servlet 和 Reactive(webflux)。采用 mica-auto 自动生成 spring.factories 和 spring-devtools.properties 配置,仅依赖 Spring boot、Spring cloud 全家桶,无第三方依赖。市面上鲜有的微服务核心组件。

依赖 版本
Spring Boot 2.2.x

mica 2.0.1 更新说明

  • ✨ 开源 mica-ip2region 组件。

  • ⚡️ mica-core 优化 R.isNotSuccess 改为 isFail。

  • ???? mica-redis jackson class info。

  • ???? mica-redis jackson findAndRegisterModules。

  • ???? travis 替换为 Github actions,用于构建和 Snapshot 版本自动发布。

  • ⬆️ update spring boot to 2.2.7.RELEASE。

版本号说明

release 版本号格式为 x.x.x.发版当然日期,避免和内部的版本号冲突。

snapshots 版本号格式为 x.x.x-SNAPSHOTsnapshots 版每次提交后会自动构建。

引用

mica-bom,可以简化依赖和依赖版本统一处理,避免jar冲突。

<dependencyManagement> 
  <dependencies> 
    <dependency> 
      <groupId>net.dreamlu</groupId>
      <artifactId>mica-bom</artifactId>
      <version>2.0.1.20200510</version>
      <type>pom</type>
      <scope>import</scope> 
    </dependency> 
  </dependencies> 
</dependencyManagement>

注意:maven 是按先后顺序进行依赖的,所以 mica-bom 顺序按 micaspring bootspring cloud依次添加。

mica-ip2region 最好用的 ip2region spring stater

maven

<dependency>
  <groupId>net.dreamlu</groupId>
  <artifactId>mica-ip2region</artifactId>
  <version>${version}</version>
</dependency>

gradle

compile("net.dreamlu:mica-ip2region:${version}")

配置说明(已经内置,忽略)

配置项 默认值 说明
mica.ip2region.db-file-location classpath:ip2region/ip2region.db ip2region.db 文件的地址,默认内置的文件

maven 自定义 ip2region.db 注意事项:

maven resources 拷贝文件是默认会做 filter,会导致我们的文件发生变化,导致不能读,pom 中你需要添加下面的配置。

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>db</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
    </configuration>
</plugin>

关于 ip2region

ip2region Gitee 源码地址:https://gitee.com/lionsoul/ip2region

我们都会同步更新 ip2region.db 文件,一般不需要手动配置。

使用文档

注入 bean

@Autowired
private Ip2regionSearcher regionSearcher;

方法说明

/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo memorySearch(long ip);
​
/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo memorySearch(String ip);
​
/**
 * ip 位置 搜索
 *
 * @param ptr ptr
 * @return 位置
 */
@Nullable
IpInfo getByIndexPtr(long ptr);
​
/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo btreeSearch(long ip);
​
/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo btreeSearch(String ip);
​
/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo binarySearch(long ip);
​
/**
 * ip 位置 搜索
 *
 * @param ip ip
 * @return 位置
 */
@Nullable
IpInfo binarySearch(String ip);

文档


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Beginning ARKit for iPhone and iPad

Beginning ARKit for iPhone and iPad

Wallace Wang / Apress / 2018-11-5 / USD 39.99

Explore how to use ARKit to create iOS apps and learn the basics of augmented reality while diving into ARKit specific topics. This book reveals how augmented reality allows you to view the screen on ......一起来看看 《Beginning ARKit for iPhone and iPad》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具