可能这正是你在寻找的现代 Java 框架?

158 阅读8分钟

“What’s the modern Java framework?” That’s an interesting question to myself.

“现代的 Java 框架是什么?”这个问题对我来说很有趣。

image.png

As most of people are using Spring framework to build java applications, especially using Spring boot. I don’t think there is anyone who doesn’t know about it, as it’s so much popular to java developers.

由于大多数人使用 Spring 框架来构建 Java 应用程序,尤其是使用 Spring Boot。我认为没有人不知道它,因为它对 Java 开发者来说非常流行。

People usually build backend applications / apis base on Spring frameworks in past 10 years, especially when the Springboot come out in 2013. I know SpringMVC was designed in Spring framework for a while before it. but the configuration is really challenging to developers.

过去十年,人们通常基于 Spring 框架构建后端应用程序/API,尤其是在 2013 年 Spring Boot 推出之后。我知道 Spring MVC 在设计之初就属于 Spring 框架的一部分,但其配置对开发者来说确实非常具有挑战性。

Springboot changed this for us, and we can quickly develop a outline to provide a bunch of apis with it, but without the knowledge about how it works. and we don’t need to start up a Tomcat server individually, That’s really friendly to us for develop a micro-service architecture style application.

Spring Boot 改变了这一切,我们可以快速开发一个框架轮廓来提供一系列 API,但无需了解其工作原理。而且我们不需要单独启动 Tomcat 服务器,这对开发微服务架构风格的应用程序非常友好。

In past 10 years, the micro-service style architecture was really important to a big project as there are many people from different domains behind it. Springboot brought a lot of benefits to multiple teams in companies as which allow a beginner can quickly provide a MVP with a good performance.

过去十年,微服务风格架构对大型项目来说非常重要,因为背后有来自不同领域众多人员的支持。Spring Boot 为公司中的多个团队带来了许多好处,使得初学者能够快速提供具有良好性能的 MVP。

Okay, Is it a perfect framework? I believe the answer is No.

好了,这是一个完美的框架吗?我相信答案是否定的。

Many developers have already known the drawbacks about it. e.g., while we don’t need to set up a tomcat, but we need to create an executable java class which include a main(String[]args) method. This is really a repeat effort and not necessary although it’s minor. and the start up requires some seconds, which will bring issues when the orchestration detect a service is down, then will start a new instance, it will take some seconds, that means during this moment, the service will not be available. but it will be an issue to some special projects.

许多开发者已经了解它的缺点。例如,虽然我们不需要设置 tomcat,但我们需要创建一个包含 main(String[]args) 方法的可执行 Java 类。虽然这只是一个小问题,但这确实是一种重复的工作,并非必要。而且启动需要几秒钟,当编排系统检测到服务宕机时,会启动一个新的实例,这需要几秒钟,这意味着在这段时间内,服务将不可用。但这对于某些特殊项目来说可能是一个问题。

Springboot is a flexible framework, which provides many interfaces that can be done by developers themselves such as aspect programming code. but actually it will slow down the process of business logic even we don’t implement it. this is too much design and probably given the room to developers and allow them to do some innovation works that could not be better. also, the overhead object management, objects reference each other, it’s too complicated and brought some issues to be resolved, but slowing down the performance of the functionalities. As developers, they need to think about how to save the resources from code design perspective. Regardless this, Springboot only focuses on the web applications, which limits the java technologies actually. As a modern application, it should be executable in web mode and command line, which is getting more important.

Springboot 是一个灵活的框架,提供了许多开发者可以自行实现的接口,例如面向切面编程代码。但实际上,即使我们不实现它,它也会减慢业务逻辑的处理过程。这过于设计化,可能给开发者留出空间,让他们进行一些无法更好的创新工作。此外,对象管理的开销、对象之间的相互引用,过于复杂,带来了一些需要解决的问题,但同时也降低了功能性能。作为开发者,他们需要从代码设计的角度思考如何节省资源。无论如何,Springboot 只关注 Web 应用程序,这实际上限制了 Java 技术。作为一个现代应用程序,它应该在 Web 模式和命令行模式下都可执行,这一点越来越重要。

As you know, Spring framework has been built with too many functionalities, it’s not a lightweight at all.

众所周知,Spring 框架已经集成了太多功能,根本不轻量级。

So, we built a new framework — tinystruct framework, which can resolve the above issues with simple philosophy.

因此,我们构建了一个新的框架——tinystruct 框架,它以简单的理念解决了上述问题。

I made a quick performance test for this framework with [wrk](https://zhida.zhihu.com/search?content_id=259697846&content_type=Article&match_order=1&q=wrk&zhida_source=entity). Here is the result:

我使用 wrk 对这个框架进行了快速性能测试。以下是结果:

$ wrk -t12 -c400 -d30s "http://127.0.0.1:8080/?q=say/Praise the Lord!"

Running 30s test @ http://127.0.0.1:8080/?q=say/Praise the Lord!
12 threads and 400 connections

Thread Stats   Avg      Stdev     Max       +/- Stdev
Latency        17.44ms  33.42ms   377.73ms  88.98%
Req/Sec        7.27k    1.66k     13.55k    69.94%

2604473 requests in 30.02s, 524.09MB read

Requests/sec:  86753.98
Transfer/sec:  17.46

That result is quite impressive. Handling over 2.6 million requests in just 30 seconds with a throughput of over 86,000 requests per second — this shows the raw power and efficiency of the tinystruct framework. But it’s not just about the performance numbers. It’s about the philosophy behind it.
那个结果相当令人印象深刻。在 30 秒内处理超过 260 万次请求,每秒吞吐量超过 86,000 次请求——这展示了 tinystruct 框架的原始力量和效率。但这不仅仅是关于性能数据。它关乎其背后的哲学。

What Makes the tinystruct Framework Modern? 是什么让 tinystruct 框架变得现代化?

  1. No need for a main() method
    无需 main() 方法
    Applications can be launched directly using CLI commands like bin/dispatcher, without boilerplate code. This removes unnecessary ceremony from the development lifecycle.
    应用程序可以直接使用 bin/dispatcher 等 CLI 命令启动,无需样板代码。这从开发生命周期中移除了不必要的仪式。

  2. Unified design for CLI and Web
    CLI 和 Web 的统一设计
    Unlike web-centric frameworks like Spring Boot, tinystruct treats CLI and Web equally. This makes it ideal for AI tasks, automation scripts, and hybrid applications—all from the same codebase.
    与以网络为中心的 Spring Boot 不同,tinystruct 将 CLI 和 Web 视为平等的公民。这使得它非常适合 AI 任务、脚本自动化和混合应用程序——所有这些都来自同一个代码库。

  3. Built-in lightweight HTTP server
    内置轻量级 HTTP 服务器
    Whether using Netty or Tomcat, tinystruct integrates the server lifecycle internally. No separate containers or complex configuration files. Just import what you need and run.
    无论是 Netty 还是 Tomcat,tinystruct 都将服务器生命周期集成在框架内部。无需单独的容器或复杂的配置文件。只需导入所需内容即可运行。

  4. Minimalist configuration philosophy
    极简配置理念
    Configuration is reduced to only what’s essential. No need to wire hundreds of beans or manage excessive XML or YAML. This boosts developer productivity and reduces errors.
    配置被简化为仅包含必要内容。你无需连接数百个 bean,也不涉及过多的 XML 或 YAML。这提高了开发者的生产力并减少了错误。

  5. Annotation-based routing
    基于注解的路由
    The framework provides a clean and intuitive routing mechanism using @Action, without complex controller hierarchies.
    该框架提供了使用 @Action 的简洁直观的路由机制,无需过于复杂的控制器层次结构。

  6. Performance-first architecture
    以性能为先的架构
    Nearly zero overhead. No reflection-based bean scanning, no autowiring labyrinths, and no unnecessary interceptors unless explicitly enabled. This results in faster response times and lower memory usage.
    几乎没有额外开销。没有基于反射的 bean 扫描,没有自动连接的迷宫,除非明确启用,否则没有不必要的拦截器。这转化为更快的响应时间和更小的内存占用。

  7. Empowering developers without complexity
    无需复杂性的开发者赋能
    With tinystruct, developers focus on real business logic instead of fighting the framework’s machinery. It’s designed to be transparent, predictable, and extensible—without sacrificing control or performance.
    使用 tinystruct,开发者可以专注于真正的业务逻辑,而不是与框架机制作斗争。它被设计为透明、可预测和可扩展——所有这些都不牺牲控制或性能。

Conclusion 结论

So, is tinystruct framework the modern Java framework you might be looking for?
那么,tinystruct 框架就是您可能正在寻找的现代 Java 框架吗?

  • If you’re tired of heavy frameworks, redundant lifecycle code, or slow boot-up times…
    如果你厌倦了臃肿的框架、冗余的生命周期代码或缓慢的启动时间…

  • If you’re looking for something lightweight, CLI-ready, and blazing fast…
    如果你正在寻找轻量级、支持命令行界面且运行极快的框架…

  • If you believe a framework should serve the developer, not slow them down…
    如果你认为框架应该服务于开发者,而不是拖慢他们的速度…

Then yes — tinystruct is that framework.
那么是的——tinystruct 就是那个框架。

It’s modern not just in terms of technology, but in philosophy — minimalistic, high-performance, and developer-friendly.
它在技术上现代,在理念上也现代——简约、高性能、且对开发者友好。
Try it out, and you might find the elegance of well-crafted software — but also praising the Lord.
试试看,你可能会发现精心构建软件的优雅——也会赞美那位创造万物的“主”。

Repo in github, Here we go:
GitHub 仓库,开始吧:github.com/tinystruct/…