Backend Development 6 min read

What Is Mica? A Lightweight Java Microservice Core for Spring Boot & Cloud

Discover Mica, a lightweight Java microservice core built on Spring Boot and Spring Cloud, its dependencies, versioning scheme, ip2region integration, configuration tips, and usage examples, providing a streamlined foundation for cloud-native applications.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
What Is Mica? A Lightweight Java Microservice Core for Spring Boot & Cloud

Mica (Cloud Mother)

Mica originated from the internal lutool project of Dream Technology, created in 2017 inspired by JHipster and evolved into a core set of microservices. It was renamed to Mica in 2019 when open‑sourced, symbolizing a cornerstone for cloud services.

Core Dependencies of Mica 2.x

Mica is built on Java 8, supports both traditional Servlet and Reactive (WebFlux). It uses mica‑auto to generate spring.factories and spring‑devtools.properties, and depends only on Spring Boot and the Spring Cloud suite, without third‑party libraries.

Spring Boot 2.2.x

Mica 2.0.1 Release Notes

Open‑source mica‑ip2region component.

Optimized mica‑core: renamed R.isNotSuccess to isFail.

Fixed jackson class info issue in mica‑redis.

Fixed jackson findAndRegisterModules issue in mica‑redis.

Replaced Travis CI with GitHub Actions for building and automatic snapshot releases.

Updated Spring Boot to 2.2.7.RELEASE.

Version Number Conventions

The

release

version follows the pattern

x.x.x.YYYYMMDD

to avoid conflicts with internal numbering. Snapshot versions use the pattern

x.x.x‑SNAPSHOT

and are built automatically on each commit.

Reference: mica‑bom

Using

mica-bom

simplifies dependency and version management, preventing JAR conflicts.

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

Note: Maven resolves dependencies in the order they are declared, so add

mica

, then

spring boot

, then

spring cloud

sequentially.

Best ip2region Spring Starter

Maven

<code>&lt;dependency&gt;
  &lt;groupId&gt;net.dreamlu&lt;/groupId&gt;
  &lt;artifactId&gt;mica-ip2region&lt;/artifactId&gt;
  &lt;version&gt;${version}&lt;/version&gt;
&lt;/dependency&gt;
</code>

Gradle

<code>compile("net.dreamlu:mica-ip2region:${version}")</code>

Configuration (Built‑in, ignore)

mica.ip2region.db-file-location (default:

classpath:ip2region/ip2region.db

) – location of the ip2region database file.

Maven custom ip2region.db considerations: The default resources filter may alter the DB file. Add the following plugin configuration to prevent filtering:

<code>&lt;plugin&gt;
  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
  &lt;configuration&gt;
    &lt;nonFilteredFileExtensions&gt;
      &lt;nonFilteredFileExtension&gt;db&lt;/nonFilteredFileExtension&gt;
    &lt;/nonFilteredFileExtensions&gt;
  &lt;/configuration&gt;
&lt;/plugin&gt;
</code>

About ip2region

The ip2region source code is hosted at https://gitee.com/lionsoul/ip2region. The

ip2region.db

file is synchronized automatically, usually requiring no manual configuration.

Usage Documentation

Inject Bean

<code>@Autowired
private Ip2regionSearcher regionSearcher;
</code>

Method Overview

<code>@Nullable
IpInfo memorySearch(long ip);
@Nullable
IpInfo memorySearch(String ip);
@Nullable
IpInfo getByIndexPtr(long ptr);
@Nullable
IpInfo btreeSearch(long ip);
@Nullable
IpInfo btreeSearch(String ip);
@Nullable
IpInfo binarySearch(long ip);
@Nullable
IpInfo binarySearch(String ip);
</code>

Documentation Links

Documentation site: https://www.yuque.com/dreamlu

Example project: https://github.com/lets-mica/mica-example

Javamicroservicesdependency managementSpring BootSpring Cloudip2regionMica
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.