Lightweight! Google has open sourced a simplified version of Spring!

Hello, I'm Guide! This is the sixth issue of JavaGuide's "Recommendation of Java High-quality Open Source Projects" . In each issue, I will select 5 high-quality Java open source projects to recommend to everyone.

The project recommendation portal of the first 5 issues:

These 5 open source projects have been included in awesome-java (a great collection of Java open source projects, a must for Java projects).

Guice: Lightweight Dependency Injection Framework

Guice is a lightweight dependency injection framework open sourced by Google, which is equivalent to a lightweight Spring Boot with extremely simplified functions. It is very practical in some cases, for example, our project only needs to use dependency injection and does not need functional features such as AOP.

Guice's Hello World example is as follows:

In the fifth phase of the project, a more lightweight Web framework than Spring is recommended! ! ! In the comment area that Microsoft and Red Hat are using , there is a small partner from a foreign company who said that he uses the framework of Guice.

做 Java 后端开发的朋友一定不要离开了 Spring 就感觉啥也干不了了,也一定不要单纯地认为 Spring 就是 Web 框架的唯一选择。Java 生态非常优秀尤其是 Web 开发领域,Github 上还有非常多优秀的开源 Web 框架,后面我会多推荐一些类似的项目。

JsonPath:JSON 数据处理

JsonPath 是一个简单易用的 JSON 数据工具类库,提供了开箱即用的 JSON 解析 API,内置了很多运算符和方法,支持 fluent API ,使用起来非常酸爽。

假设我们有如下 JSON 数据需要处理。

如果我们需要读取出所有书的作者,下面两行代码就可以了:

String json = "...";
List<String> authors = JsonPath.read(json, "$.store.book[*].author");
复制代码

如果我们需要读取出金额大于 10 的书,下面一行代码就可以了:

List<Map<String, Object>> expensiveBooks = JsonPath
                            .using(configuration)
                            .parse(json)
                            .read("$.store.book[?(@.price > 10)]", List.class);
复制代码

项目地址:github.com/json-path/J…

tianai-captcha:好看又好用的滑块验证码

tianai-captcha 是一个开源的 Java 滑块验证码 解决方案,开箱即用,支持行为轨迹校验和混淆滑块。

项目地址:gitee.com/tianai/tian…

Testcontainers:测试工具库

Testcontainers 是一个支持 JUnit 的测试工具库,提供轻量级的且一次性的常见数据库测试支持、Selenium Web浏览器或者其他任何可以在Docker 容器中运行的实例支持。

Testcontainers 提供的一次性常见数据库测试支持有什么用呢?简单举个例子:假设我们有一个依赖 Redis 的程序,我们需要为其编写测试。如果测试直接使用的是本地安装的 Redis ,会带来很多麻烦,这意味着每个开发人员以及 CI 机器都必须安装 Redis 。并且,为了保证测试的正常运行 ,Redis 的版本也要尽量保持一致。显然,这是不太现实的!

Thoughtworks 第 26 期技术雷达这样写到:

根据长期使用 Testcontainers 的经验,我们认为它是创建可靠的环境来运行自动化测试的默认选项。 Testcontainers 是一个拥有多种语言版本 的库,并且 docker 化了常见的测试依赖——包括了不同种类的数据库,队列技术,云服务和 UI 测试依赖(例如 web 浏览器),还具有按需运行自定义 Dockerfile 的能力。它与类似 JUnit 的测试框架兼容,而且足够灵活,可以让用户管理容器的生命周期和高级网络,并迅速建立一个集成测试环境

libgdx:

libgdx 是一款跨平台的 Java 游戏开发框架,适用于 Windows、Linux、macOS、Android、您的浏览器和 iOS,稳定且成熟。

并且,libgdx 的生态系统里有非常多现成的工具库,可以帮助我们节省很多事情。

如果你想要使用 Java 开发游戏的话,一定要来看看这个项目。

项目地址:github.com/libgdx/libg…

后记

Focus on Java original dry goods sharing, the junior open source JavaGuide  ("Java Learning + Interview Guide" covers the core knowledge that most Java programmers need to master. Prepare for Java interviews, JavaGuide is the first choice!), currently has 120k+ Stars.

Originality is not easy, welcome to like and share, welcome to follow my account in Nuggets , I will continue to share original dry goods! come on, go

Guess you like

Origin juejin.im/post/7086366945443840013