Browse Source

[Java] Update Solon Version To 3.0.4 (#9438)

* Update Solon Version To 2.9.1

* Update Solon Version To 2.9.1

* Update Solon Jdk To 21

* Update Solon Jdk To 21

* Update Solon Jdk To 21

* Update Solon Jdk To 21

* Update Solon Jdk To 21

* Update Solon Version To 2.9.2

* Add Solon-Virtual

* Remove solon-virtual

* Update Solon Version To 3.0.2

* Add Solon-Vertx

* Tweak description

* Tweak the dockerfile

* Tweak the dockerfile

* Tweak config

* Tweak dockefile name

* Add FilterImpl

* Add FilterImpl

* The json plugin is changed to jackson

* Update Solon Jdk To 23

* Update Solon-Vertx Jdk To 23

* Solon-vertx is restored to jdk 21

* Solon is restored to jdk 21

* Solon-vertx adjusts the Date output format

* Solon is restored to jdk 21

* Remove solon-vertx

* [Java] Update Solon Version To 3.0.3

* [Java] Update Solon Version To 3.0.4

* [Java] remove solon-vertx

* [Java] Update Solon Version To 3.0.4

* [Java] Update Solon Version To 3.0.4

* [Java] Update Solon Version To 3.0.4

* [Java] Update Solon Version To 3.0.4
西东 8 months ago
parent
commit
3bbbb59402

+ 0 - 23
frameworks/Java/solon-vertx/README.md

@@ -1,23 +0,0 @@
-# solon-vertx Benchmarking Test
-
-
-This is the solon-vertx portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-* [JSON test source](src/main/java/hello/Main.java)
-* [Plaintext test source](src/main/java/hello/Main.java)
-
-## Versions
-
-* [Java OpenJDK 21](http://openjdk.java.net/)
-* [solon 3.0.2](https://github.com/noear/solon)
-
-## Test URLs
-
-### JSON Encoding Test
-
-    http://localhost:8080/json
-    
-### Plaintext Encoding Test
-
-    http://localhost:8080/plaintext

+ 0 - 26
frameworks/Java/solon-vertx/benchmark_config.json

@@ -1,26 +0,0 @@
-{
-  "framework": "solon-vertx",
-  "tests": [
-    {
-      "default": {
-        "json_url": "/json",
-        "plaintext_url": "/plaintext",
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Fullstack",
-        "database": "None",
-        "framework": "solon",
-        "language": "Java",
-        "flavor": "None",
-        "orm": "Micro",
-        "platform": "Netty",
-        "webserver": "None",
-        "os": "Linux",
-        "database_os": "Linux",
-        "display_name": "solon-vertx",
-        "notes": "",
-        "versus": "solon"
-      }
-    }
-  ]
-}

+ 0 - 15
frameworks/Java/solon-vertx/config.toml

@@ -1,15 +0,0 @@
-[framework]
-name = "solon-vertx"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-approach = "Realistic"
-classification = "Platform"
-database = "None"
-database_os = "Linux"
-os = "Linux"
-orm = "Micro"
-platform = "Netty"
-webserver = "None"
-versus = "solon"

+ 0 - 61
frameworks/Java/solon-vertx/pom.xml

@@ -1,61 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.noear</groupId>
-        <artifactId>solon-parent</artifactId>
-        <version>3.0.2</version>
-    </parent>
-
-    <groupId>hello</groupId>
-    <artifactId>hello-solon</artifactId>
-    <version>1.0</version>
-    <packaging>jar</packaging>
-
-    <properties>
-        <java.version>21</java.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.noear</groupId>
-            <artifactId>solon-boot-vertx</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.noear</groupId>
-            <artifactId>solon-serialization-jackson</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <finalName>${project.artifactId}</finalName>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                    <archive>
-                        <manifest>
-                            <mainClass>hello.Main</mainClass>
-                        </manifest>
-                    </archive>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 13
frameworks/Java/solon-vertx/solon-vertx.dockerfile

@@ -1,13 +0,0 @@
-FROM maven:3.9.7-amazoncorretto-21 as maven
-WORKDIR /solon
-COPY pom.xml pom.xml
-COPY src src
-RUN mvn compile assembly:single -q
-
-FROM openjdk:21-jdk-slim
-WORKDIR /solon
-COPY --from=maven /solon/target/hello-solon.jar app.jar
-
-EXPOSE 8080
-
-CMD ["java", "-server", "-cp", "app.jar", "hello.Main"]

+ 0 - 13
frameworks/Java/solon-vertx/src/main/java/hello/Main.java

@@ -1,13 +0,0 @@
-package hello;
-
-import org.noear.solon.Solon;
-
-/**
- * @author noear
- * @version V1.0
- */
-public class Main {
-	public static void main(String[] args) {
-		Solon.start(Main.class, args);
-	}
-}

+ 0 - 23
frameworks/Java/solon-vertx/src/main/java/hello/controller/FilterImpl.java

@@ -1,23 +0,0 @@
-package hello.controller;
-
-import org.noear.solon.annotation.Component;
-import org.noear.solon.core.handle.Context;
-import org.noear.solon.core.handle.Filter;
-import org.noear.solon.core.handle.FilterChain;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@Component
-public class FilterImpl implements Filter {
-    private static DateFormat DATE_FORMAT = new SimpleDateFormat("EEE, d MMM yyyyy HH:mm:ss z");
-
-    @Override
-    public void doFilter(Context ctx, FilterChain chain) throws Throwable {
-        String dateString = DATE_FORMAT.format(new Date());
-        ctx.headerSet("Date", dateString);
-        ctx.headerSet("Server", "solon-boot-vertx");
-        chain.doFilter(ctx);
-    }
-}

+ 0 - 25
frameworks/Java/solon-vertx/src/main/java/hello/controller/HelloController.java

@@ -1,25 +0,0 @@
-package hello.controller;
-
-import org.noear.solon.annotation.Controller;
-import org.noear.solon.annotation.Get;
-import org.noear.solon.annotation.Mapping;
-import hello.model.Message;
-
-/**
- * @author noear
- * @version V1.0
- */
-@Controller
-public class HelloController {
-    @Get
-    @Mapping("plaintext")
-    public String plaintext() {
-        return "Hello, World!";
-    }
-
-    @Get
-    @Mapping("json")
-    public Message json() {
-        return new Message("Hello, World!");
-    }
-}

+ 0 - 21
frameworks/Java/solon-vertx/src/main/java/hello/model/Message.java

@@ -1,21 +0,0 @@
-package hello.model;
-
-/**
- * @author noear
- * @version V1.0
- */
-public class Message {
-    private String message;
-
-    public Message(String message) {
-        this.message = message;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-}

+ 0 - 1
frameworks/Java/solon-vertx/src/main/resources/app.properties

@@ -1 +0,0 @@
-server.http.ioBound=false

+ 3 - 3
frameworks/Java/solon/benchmark_config.json

@@ -3,16 +3,16 @@
   "tests": [
   "tests": [
     {
     {
       "default": {
       "default": {
-        "json_url": "/json",
         "plaintext_url": "/plaintext",
         "plaintext_url": "/plaintext",
+        "json_url": "/json",
         "port": 8080,
         "port": 8080,
         "approach": "Realistic",
         "approach": "Realistic",
         "classification": "Fullstack",
         "classification": "Fullstack",
-        "database": "None",
+        "database": "Postgres",
         "framework": "solon",
         "framework": "solon",
         "language": "Java",
         "language": "Java",
         "flavor": "None",
         "flavor": "None",
-        "orm": "Full",
+        "orm": "Micro",
         "platform": "solon",
         "platform": "solon",
         "webserver": "smarthttp",
         "webserver": "smarthttp",
         "os": "Linux",
         "os": "Linux",

+ 2 - 2
frameworks/Java/solon/config.toml

@@ -6,10 +6,10 @@ urls.plaintext = "/plaintext"
 urls.json = "/json"
 urls.json = "/json"
 approach = "Realistic"
 approach = "Realistic"
 classification = "Platform"
 classification = "Platform"
-database = "None"
+database = "Postgres"
 database_os = "Linux"
 database_os = "Linux"
 os = "Linux"
 os = "Linux"
-orm = "Raw"
+orm = "Micro"
 platform = "solon"
 platform = "solon"
 webserver = "smarthttp"
 webserver = "smarthttp"
 versus = "None"
 versus = "None"

+ 1 - 1
frameworks/Java/solon/pom.xml

@@ -5,7 +5,7 @@
     <parent>
     <parent>
         <groupId>org.noear</groupId>
         <groupId>org.noear</groupId>
         <artifactId>solon-parent</artifactId>
         <artifactId>solon-parent</artifactId>
-        <version>3.0.3</version>
+        <version>3.0.4</version>
     </parent>
     </parent>
 
 
     <groupId>hello</groupId>
     <groupId>hello</groupId>

+ 6 - 11
frameworks/Java/solon/src/main/java/hello/repository/JdbcDbRepository.java

@@ -7,7 +7,6 @@ import org.noear.solon.annotation.Inject;
 import org.noear.solon.data.sql.SqlUtils;
 import org.noear.solon.data.sql.SqlUtils;
 
 
 import java.sql.SQLException;
 import java.sql.SQLException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 @Component
 @Component
@@ -19,8 +18,7 @@ public class JdbcDbRepository implements DbRepository {
     public World getWorld(int id) {
     public World getWorld(int id) {
         try {
         try {
             return sqlUtils.sql("SELECT id, randomnumber FROM world WHERE id = ?", id)
             return sqlUtils.sql("SELECT id, randomnumber FROM world WHERE id = ?", id)
-                    .queryRow()
-                    .toBean(World.class, (r, t) -> new World((int) r.getObject(1), (int) r.getObject(2)));
+                    .queryRow((rs) -> new World(rs.getInt(1), rs.getInt(2)));
         } catch (Exception e) {
         } catch (Exception e) {
             return null;
             return null;
         }
         }
@@ -28,19 +26,16 @@ public class JdbcDbRepository implements DbRepository {
 
 
     @Override
     @Override
     public void updateWorlds(List<World> worlds) throws SQLException {
     public void updateWorlds(List<World> worlds) throws SQLException {
-        List<Object[]> values = new ArrayList<>();
-        for (World w : worlds) {
-            values.add(new Object[]{w.randomNumber, w.id});
-        }
-
         sqlUtils.sql("UPDATE world SET randomnumber = ? WHERE id = ?")
         sqlUtils.sql("UPDATE world SET randomnumber = ? WHERE id = ?")
-                .updateBatch(values);
+                .updateBatch(worlds, (ps, w) -> {
+                    ps.setInt(1, w.randomNumber);
+                    ps.setInt(2, w.id);
+                });
     }
     }
 
 
     @Override
     @Override
     public List<Fortune> fortunes() throws SQLException {
     public List<Fortune> fortunes() throws SQLException {
         return sqlUtils.sql("SELECT id, message FROM fortune")
         return sqlUtils.sql("SELECT id, message FROM fortune")
-                .queryRowList()
-                .toBeanList(Fortune.class, (r, t) -> new Fortune((int) r.getObject(1), (String) r.getObject(2)));
+                .queryRowList((r) -> new Fortune(r.getInt(1), r.getString(2)));
     }
     }
 }
 }