輕量級的應用開發框架 - Solon

一、Solon 是什麼?

Solon,是一個輕量級的應用開發框架。更快、更小、更自由!
支持 jdk8、jdk11、jdk17+;主框架 0.1Mb;組合不同的插件應對不同需求;方便定製;快速開發。

二、Solon 具有哪些特點?

三、Solon 的學習資料有哪些?

官方網站:
http://solon.noear.org/

官方文檔:
http://solon.noear.org/article/learn-start

Giee 源代碼:
https://gitee.com/noear/solon

Github 源代碼:
https://github.com/noear/solon

生態架構圖:

主框架及快速集成開發包:

代碼示例:

四、如何編寫一個非常簡單的示例進行體驗?

1. 新建項目並配置 pom.xml

<parent>
    <groupId>org.noear</groupId>
    <artifactId>solon-parent</artifactId>
    <version>1.10.6</version>
    <relativePath />
</parent>
<properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
    <dependency>
        <groupId>org.noear</groupId>
        <artifactId>solon-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.noear</groupId>
        <artifactId>solon-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <compilerArgument>-parameters</compilerArgument>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.3.0</version>
            <configuration>
                <finalName>${project.artifactId}</finalName>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>org.example.demo.DemoApp</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

2. 配置文件 (app.yml)

server.port:  8080
solon.app:
  group: demo
  name: demo_app

3. 編寫主類

import org.noear.solon.Solon;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.annotation.Param;
@Controller
public class DemoApp {
    public static void main(String[] args) {
        Solon.start(DemoApp.class, args);
    }
    @Mapping("/hello")
    public String hello(@Param(defaultValue = "world") String name) {
        return String.format("Hello %s!", name);
    }
}

五、爲什麼選擇 Solon?

爲什麼選擇 Solon 不等同於一定要選擇 Solon,Solon 即可應用於單體應用開發也能應用於微服務應用開發,相當於 Solon 可作爲 Java 生態開發的另外一種選擇。作爲架構師而言,選擇既要多,也要穩,既要敢於創新,也要結合實際業務需求進行平衡。

本文由 Readfog 進行 AMP 轉碼,版權歸原作者所有。
來源https://mp.weixin.qq.com/s/o6UVEf98mD4uOKc_c52KeA