Explore Mica 2.4.x: New Features, Logging, and QR Code Module for Backend Development

This article introduces the Mica microservice framework, covering its origin, version matrix, recent updates—including a QR‑code module and revamped logging configuration—along with usage examples, ecosystem components, and documentation links for developers.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
Explore Mica 2.4.x: New Features, Logging, and QR Code Module for Backend Development

1. Mica (Cloud Mica)

mica

originated from the internal lutool of Dream Technology. lutool was created in 2017, inspired by jhipster, and gradually formed a core set of microservices. Because the name lutool did not match its functionality, it was renamed to mica in 2019, symbolizing a cornerstone of cloud services.

2. Version Information

Note: The mica‑v2.0 branch only receives bug fixes and no new features.

Latest Version

mica Version

Spring Boot Version

Spring Cloud Version

2.4.4-GA

mica 2.4.x

2.4.x

2020

2.1.1-GA

mica 2.0.x~2.1.x

2.2.x ~ 2.3.x

Hoxton

3. Update Log

v2.4.4‑GA – 2021‑03‑28

✨ Added mica-qrcode module for friendly QR code generation and recognition.

✨ Redesigned mica-logging; logstash‑logback‑encoder is now optional, logstash and json require manual dependencies.

✨ Optimized DesensitizationUtil in mica-core.

✨ Added ImageUtil to mica-core.

✨ Updated mica-ip2region database file.

🐛 Fixed null‑pointer in mica-redis ScanOptions count.

⬆️ Upgraded mica-auto to 2.0.4.

⬆️ Upgraded mica-weixin to 2.0.6.

⬆️ Upgraded Spring Cloud to 2020.0.2.

⬆️ Upgraded Spring Boot to 2.4.4.

4. mica‑logging

4.1 Rules

By default, logs are printed to console, all.log, and error.log.

When set to json format, console logs (non‑json) and all.log (json) are printed, suitable for filebeat collection.

Enable logstash to print console logs and output them to logstash (it is recommended to disable file output).

After startup, the console log can be disabled via configuration.

Note: When json file or logstash is enabled, you must add the logstash‑logback‑encoder dependency.

4.2 Log Examples

File Log

2021-03-25 21:03:55.275  INFO 2354 --- [XNIO-1 task-3] n.d.mica.mybatis.logger.SqlLogFilter     :

======= Sql Logger ======================
select id, parent_id, title, name, seq , path, permission, component, icon, is_frame , type, cache, hidden, status, remark , created_by, created_at, updated_by, updated_at from sys_menu where type in (0, 1) and hidden = false and status = 0
======= Sql Execute Time: 3.438ms =======

JSON Log

{
  "loggingLevelRoot":"info",
  "appName":"mica-fast",
  "profile":"dev",
  "level":"INFO",
  "logger_name":"o.s.b.w.e.u.UndertowWebServer",
  "message":"Undertow started on port(s) 8080 (http)",
  "thread_name":"main",
  "@timestamp":"2021-03-25T13:10:34.371Z"
}

Logstash Log (stdout)

{
  "port" => 57146,
  "@version" => "1",
  "profile" => "dev",
  "logger_name" => "net.dreamlu.mica.mybatis.logger.SqlLogFilter",
  "appName" => "mica-fast",
  "thread_name" => "XNIO-1 task-3",
  "level" => "INFO",
  "level_value" => 20000,
  "message" => "

======= Sql Logger ======================
select id, parent_id, title, name, seq , path, permission, component, icon, is_frame , type, cache, hidden, status, remark , created_by, created_at, updated_by, updated_at from sys_menu where type in (0, 1) and hidden = false and status = 0
======= Sql Execute Time: 3.438ms =======
",
  "loggingLevelRoot" => "info",
  "host" => "localhost",
  "requestId" => "d17d635f0a479f01f846199231008ec9",
  "@timestamp" => "2021-03-25T13:03:55.275Z"
}

5. mica‑qrcode

This module, heavily modified from nutzmore (nutz‑plugins‑qrcode), offers a simpler API, multiple stream and byte‑array interfaces, and is more microservice‑friendly.

Usage Example:

// Generate QR code
QrCode.form("牛年大吉")
    .size(512) // default 512
    .backGroundColor(Color.WHITE) // default white
    .foreGroundColor(Color.BLACK) // default black
    .encode(Charsets.UTF_8) // default UTF_8
    .imageFormat("png") // default png
    .deleteMargin(true) // remove white margin
    .logo("/Users/lcm/Desktop/mica-mqtt-01.png") // logo, supports URL, file, stream
    .toFile("/Users/lcm/Desktop/xxx1.png"); // write out, also toImage, toStream, toBytes

// Read QR code
String text = QrCode.read("/Users/lcm/Desktop/xxx1.png");
System.out.println(text);

6. Mica Ecosystem

mica-auto (Spring Boot starter): https://gitee.com/596392912/mica-auto

mica-weixin (JFinal Weixin Spring Boot starter): https://gitee.com/596392912/mica-weixin

mica-mqtt (MQTT component based on t‑io): https://gitee.com/596392912/mica-mqtt

Spring Cloud microservice HTTP/2 solution (h2c): https://gitee.com/596392912/spring-cloud-java11

7. Documentation

Mica source code Gitee: https://gitee.com/596392912/mica

Mica source code GitHub: https://github.com/lets-mica

Official docs: http://wiki.dreamlu.net

Yuque docs (subscribe): https://www.yuque.com/dreamlu

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

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

MicroservicesQR codebackend-developmentspring-boot
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

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.