"¡Cuán numerosas son tus obras, oh SEÑOR! Con sabiduría las hiciste todas; la tierra está llena de tus criaturas."
Salmos 104:24
Language: English | Português (Brasil) | 简体中文 | 繁體中文 | 日本語 | 한국어 | Türkçe | Русский | Tiếng Việt | ไทย | Deutsch | Español
Un framework sencillo para el desarrollo en Java. Pensamiento simple, mejor diseño, fácil de usar y con buen rendimiento.
- Java Development Kit (JDK) 17 o superior
- Maven para la gestión de dependencias
- Un editor de texto o IDE como IntelliJ IDEA, Eclipse o VS Code
Puedes usar este archetype para crear rápidamente un proyecto basado en tinystruct: https://github.com/tinystruct/tinystruct-archetype
- Agrega la dependencia a tu pom.xml.
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.7.28</version>
<classifier>jar-with-dependencies</classifier> <!-- Opcional -->
</dependency>- Extiende AbstractApplication en 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.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 Puedes acceder a estas 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.46MBProcesar más de 86.000 solicitudes por segundo con baja latencia promedio, alrededor de 17,44 ms, indica que el endpoint es muy eficiente bajo carga intensa. Esto muestra la potencia y eficiencia del framework tinystruct, pero no se trata solo de números: también importa la filosofía detrás.
-
No requiere método
main()Las aplicaciones pueden iniciarse directamente con comandos CLI comobin/dispatcher, sin código repetitivo. -
Diseño unificado para CLI y Web tinystruct trata CLI y Web como ciudadanos de primera clase, ideal para tareas de IA, automatización de scripts y aplicaciones híbridas.
-
Servidor HTTP ligero integrado Ya sea Netty o Tomcat, tinystruct integra el ciclo de vida del servidor dentro del framework.
-
Filosofía de configuración mínima La configuración se limita a lo esencial, sin grandes cantidades de beans ni XML o YAML excesivos.
-
Enrutamiento basado en anotaciones
@Actionofrece un mecanismo de enrutamiento claro e intuitivo. -
Arquitectura enfocada en rendimiento Casi sin sobrecarga, sin escaneo de beans basado en reflexión ni interceptores innecesarios.
-
Empoderamiento del desarrollador sin complejidad tinystruct permite enfocarse en la lógica de negocio real con un diseño transparente, predecible y extensible.
Licenciado bajo Apache License, Version 2.0. No puedes usar este archivo excepto de conformidad con la licencia. Puedes obtener una copia en:
http://www.apache.org/licenses/LICENSE-2.0A menos que la ley aplicable lo exija o se acuerde por escrito, el software distribuido bajo la licencia se proporciona "TAL CUAL", sin garantías ni condiciones de ningún tipo.
