"主よ、あなたのみわざはなんと多いことでしょう。あなたはそれらをみな知恵をもって造られました。地はあなたの造られたもので満ちています。"
詩篇 104:24
Language: English | Português (Brasil) | 简体中文 | 繁體中文 | 日本語 | 한국어 | Türkçe | Русский | Tiếng Việt | ไทย | Deutsch | Español
Java 開発のためのシンプルなフレームワークです。シンプルな考え方、より良い設計、使いやすさ、そして高い性能を目指しています。
- Java Development Kit (JDK) 17 以上
- 依存関係管理のための Maven
- IntelliJ IDEA、Eclipse、VS Code などのテキストエディタまたは IDE
この archetype を使うと、tinystruct ベースのプロジェクトをすばやく作成できます: https://github.com/tinystruct/tinystruct-archetype
- pom.xml に依存関係を追加します。
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.7.28</version>
<classifier>jar-with-dependencies</classifier> <!-- 任意 -->
</dependency>- Java で AbstractApplication を継承します:
package tinystruct.examples;
import org.tinystruct.AbstractApplication;
import org.tinystruct.ApplicationException;
import org.tinystruct.system.annotation.Action;
public class example extends AbstractApplication {
@Override
public void init() {
// TODO Auto-generated method stub
}
@Override
public String version() {
return "1.0";
}
@Action("praise")
public String praise() {
return "Praise the Lord!";
}
@Action("say")
public String say() throws ApplicationException {
if (null != getContext().getAttribute("--words"))
return getContext().getAttribute("--words").toString();
throw new ApplicationException("Could not find the parameter <i>words</i>.");
}
@Action("say")
public String say(String words) {
return words;
}
@Action(value = "hello", mode = Mode.HTTP_GET)
public String helloGet() {
return "GET";
}
@Action(value = "hello", mode = Mode.HTTP_POST)
public String helloPost() {
return "POST";
}
}Smalltalk: https://github.com/tinystruct/smalltalk
$ bin/dispatcher --version
_/ ' _ _/ _ _ _/
/ / /) (/ _) / / (/ ( / 1.7.28
/$ bin/dispatcher --help
Usage: bin/dispatcher COMMAND [OPTIONS]
A command line tool for tinystruct framework
Commands:
download Download a resource from other servers
exec To execute native command(s)
generate POJO object generator
install Install a package
maven-wrapper Extract Maven Wrapper
open Start a default browser to open the specific URL
say Output words
set Set system property
sql-execute Executes the given SQL statement, which may be an INSERT, UPDATE, DELETE, or DDL statement
sql-query Executes the given SQL statement, which returns a single ResultSet object
update Update for latest version
Options:
--allow-remote-access Allow to be accessed remotely
--help Help command
--host Host name / IP
--import Import application
--logo Print logo
--settings Print settings
--version Print version
Run 'bin/dispatcher COMMAND --help' for more information on a command.$ bin/dispatcher say/"Praise the Lord"
Praise the Lord$ bin/dispatcher say --words Hello --import tinystruct.examples.example
Hello# bin/dispatcher start --import org.tinystruct.system.HttpServer 以下の URL にアクセスできます:
$ 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.46MB平均レイテンシ約 17.44ms という低い遅延で 86,000 を超えるリクエストを毎秒処理できることは、このエンドポイントが高負荷下でも非常に効率的であることを示しています。これは tinystruct フレームワーク の性能と効率を示すものですが、重要なのは数値だけではなく、その背後にある思想です。
-
main()メソッドが不要 アプリケーションはbin/dispatcherなどの CLI コマンドから直接起動できます。 -
CLI と Web の統一設計 tinystruct は CLI と Web を同等に扱い、AI タスク、スクリプト自動化、ハイブリッドアプリケーションに適しています。
-
軽量 HTTP サーバーを内蔵 Netty でも Tomcat でも、サーバーのライフサイクルをフレームワーク内に統合します。
-
最小限の設定思想 設定は必要最小限で、過剰な bean、XML、YAML は不要です。
-
アノテーションベースのルーティング
@Actionにより、明確で直感的なルーティングを実現します。 -
性能優先のアーキテクチャ オーバーヘッドはほぼなく、リフレクションベースの bean スキャンや不要な interceptor はありません。
-
複雑さを増やさず開発者を支援 tinystruct は実際のビジネスロジックに集中できるように設計され、透明で予測可能かつ拡張可能です。
Apache License, Version 2.0 に基づいてライセンスされています。 このライセンスに従う場合を除き、このファイルを使用することはできません。 ライセンスのコピーは以下で入手できます:
http://www.apache.org/licenses/LICENSE-2.0
適用法令で要求される場合、または書面で合意された場合を除き、このライセンスの下で配布されるソフトウェアは「現状のまま」提供され、いかなる保証または条件もありません。
