"Quantas são as tuas obras, SENHOR! Fizeste todas elas com sabedoria; a terra está cheia das tuas criaturas."
Salmos 104:24
Language: English | Português (Brasil) | 简体中文 | 繁體中文 | 日本語 | 한국어 | Türkçe | Русский | Tiếng Việt | ไทย | Deutsch | Español
Um framework simples para desenvolvimento Java. Pensamento simples, melhor design, fácil de usar e com bom desempenho.
- Java Development Kit (JDK) 17 ou superior
- Maven para gerenciamento de dependências
- Um editor de texto ou IDE como IntelliJ IDEA, Eclipse ou VS Code
Você pode usar este archetype para criar rapidamente um projeto baseado em tinystruct: https://github.com/tinystruct/tinystruct-archetype
Ou crie um projeto com um único comando (Linux/macOS, requer JDK 17+ e Maven; tipos: basic, web, mcp, workflow, agent):
curl -fsSL https://tinystruct.org/create | shNo Windows (requer Git for Windows ou WSL), execute no PowerShell:
irm https://tinystruct.org/create.ps1 | iex- Adicione a dependência ao seu pom.xml.
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.7.36</version>
</dependency>Para usar o framework como uma ferramenta de linha de comando independente, gere o JAR opcional que inclui todas as dependências (cerca de 50 MB, não faz parte do release):
./mvnw package -Pstandalone # Windows: mvnw.cmd package -Pstandalone
java -jar target/tinystruct-1.7.36-jar-with-dependencies.jar --help- Estenda AbstractApplication em Java:
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.36
/$ 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 Você pode acessar as URLs abaixo:
$ 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.46MBProcessar mais de 86.000 requisições por segundo com baixa latência média, cerca de 17,44 ms, indica que o endpoint é altamente eficiente sob carga pesada. Isso mostra a força e a eficiência do framework tinystruct, mas não se trata apenas dos números: trata-se também da filosofia por trás dele.
-
Não requer método
main()Aplicações podem ser iniciadas diretamente com comandos CLI comobin/dispatcher, sem código repetitivo. -
Design unificado para CLI e Web tinystruct trata CLI e Web como recursos igualmente importantes, ideal para tarefas de IA, automação de scripts e aplicações híbridas.
-
Servidor HTTP leve integrado Seja Netty ou Tomcat, tinystruct integra o ciclo de vida do servidor ao framework.
-
Filosofia de configuração mínima A configuração fica limitada ao essencial, sem excesso de beans, XML ou YAML.
-
Roteamento baseado em anotações
@Actionfornece um mecanismo de roteamento limpo e intuitivo. -
Arquitetura orientada a desempenho Quase sem overhead, sem varredura de beans baseada em reflexão e sem interceptadores desnecessários.
-
Mais controle sem complexidade tinystruct permite focar na lógica de negócio real com um design transparente, previsível e extensível.
Licenciado sob a Apache License, Version 2.0. Você não pode usar este arquivo exceto em conformidade com a licença. Você pode obter uma cópia em:
http://www.apache.org/licenses/LICENSE-2.0
Salvo exigência legal ou acordo por escrito, o software distribuído sob a licença é fornecido "NO ESTADO EM QUE SE ENCONTRA", sem garantias ou condições de qualquer tipo.
