mica (mica)
mica evolved from the lutool within dreamlike technology. Lutool was born in 2017. Inspired by jhipster, it has gradually formed a core set of micro services.
Because the name of lutool does not match the function, it will be renamed mica (MICA) when it is opened in 2019, which means the cornerstone of cloud services.
mica 2.x core dependency
Mica is based on java 8 and has no historical burden. It supports traditional Servlet and Reactive (webplus). The configuration of spring.factories and spring-devtools.properties is automatically generated by mica auto, which only relies on Spring boot and Spring cloud family buckets, without third-party dependence. There are few micro service core components on the market.
rely on edition Spring Boot 2.2.xmica 2.0.1 update description
- : sparkles: open source mica-ip2region component.
- : zap: Mica core optimize R.isNotSuccess to isFail.
- :bug: mica-redis jackson class info.
- :bug: mica-redis jackson findAndRegisterModules.
- : Wrap: Travis is replaced with Github actions for build and Snapshot version auto release.
- :arrow_up: update spring boot to 2.2.7.RELEASE.
Version number Description
Release version number format is x.x.x. release date of course, to avoid conflict with internal version number.
The snapshot version number format is x.x.x-SNAPSHOT, which will be built automatically after each submission.
quote
Mica BOM can simplify the unified processing of dependency and dependent version and avoid jar conflict.
<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>
Note: maven is dependent in order, so mica BOM is added in order of mica, spring boot and spring cloud.
The best ip2region spring station for mica-ip2region
maven
<dependency> <groupId>net.dreamlu</groupId> <artifactId>mica-ip2region</artifactId> <version>$</version> </dependency>
gradle
compile("net.dreamlu:mica-ip2region:$")
Configuration description (built in, ignored)
Configuration item Default explain mica.ip2region.db-file-location classpath:ip2region/ip2region.db Address of ip2region.db file, default built-in fileNote for maven to customize ip2region.db:
The maven resources copy file is a filter by default, which will change our file and make it unreadable. You need to add the following configuration in pom.
<plugin> <artifactId>maven-resources-plugin</artifactId> <configuration> <nonFilteredFileExtensions> <nonFilteredFileExtension>db</nonFilteredFileExtension> </nonFilteredFileExtensions> </configuration> </plugin>
About ip2region
ip2region Gitee source address: https://gitee.com/lionsoul/ip2region
We will update the ip2region.db file synchronously, generally without manual configuration.
Working with documents
Injection bean
@Autowired private Ip2regionSearcher regionSearcher;
Method description
/** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo memorySearch(long ip); /** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo memorySearch(String ip); /** * ip Location search * * @param ptr ptr * @return position */ @Nullable IpInfo getByIndexPtr(long ptr); /** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo btreeSearch(long ip); /** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo btreeSearch(String ip); /** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo binarySearch(long ip); /** * ip Location search * * @param ip ip * @return position */ @Nullable IpInfo binarySearch(String ip);
file
- Document address (Language sparrow - pay attention to subscription): https://www.yuque.com/dreamlu
- Sample project: https://github.com/lets-mica/mica-example
Welcome to our official account: JAVA architecture diary, wonderful content daily push.