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.
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
releaseversion follows the pattern
x.x.x.YYYYMMDDto avoid conflicts with internal numbering. Snapshot versions use the pattern
x.x.x‑SNAPSHOTand are built automatically on each commit.
Reference: mica‑bom
Using
mica-bomsimplifies dependency and version management, preventing JAR conflicts.
<code><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>
</code>Note: Maven resolves dependencies in the order they are declared, so add
mica, then
spring boot, then
spring cloudsequentially.
Best ip2region Spring Starter
Maven
<code><dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-ip2region</artifactId>
<version>${version}</version>
</dependency>
</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><plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>db</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</code>About ip2region
The ip2region source code is hosted at https://gitee.com/lionsoul/ip2region. The
ip2region.dbfile 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
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.