Act-1.8.24 released - non Slim Java Web framework

1. Core Framework (act-1.8.24) Update:

# 1151 allows the filter to the resource file in development mode 

We all know that Maven can build the release packages when the resource file filtering in the old farm yard in a project on the use of this feature maven, refer to the following code:

<script src="/asset/js/main.js?v=${buildNumber}"></script>

After running the above code is packaged in `$ {buildNumber}` will be replaced with resource maven plugin for similar 5b79fc this stuff, here are absolutely no problems. In developing the direct operation of the trouble, though not buildNumber in the development stage it does not matter, the problem is that the browser does not recognize the URL `` $ {these symbols, resulting in js file can not be loaded at the time of development. 

# 1151 This new enhancement allows the application to set the following configuration 

resource.filtering=true

When the above configuration items to `true`, the framework will be in the development of static file filter, replace the above` `$ {...} variable of type. Alternative is to find a keyword from the configuration, if not find to replace the empty string.

# 1149 CSV view - the type of support AdaptiveBean

AdaptiveBean is ActFramework original data type, set the functions of a POJO and Map. This enhancement allows CSV support the view controller returns Iterable <AdaptiveBean> correct type of data and generate a CSV file

# 1148 occurs when starting Block issue did not display the correct error page

Recently the old code of agricultural development process can not access the services of a sudden found:

Looked at the console, the original block issue occurs when you start (normal operation of the program to prevent the problem):

This is not normal, ah, should show an error page that fishes # 1148 fixes this problem, block when the normal start reporting the issue:

# 1147 resource loader - Enhanced Map type of key, value type parameter processing

假设有这么一个资源文件 `test.map`:

1=true
2=false

以前要加载上面文件内容到 Map 只能这样声明加载:

@LoadResource("test.map")
private Map<String, String> testMap;

这个改进允许应用采用其他 Key, Value 类型来声明 Map 了:

@LoadResource("test.map")
private Map<Integer, Boolean> testMap;

#1146 支持加载 Map 类型资源的时候忽略单行与行内注释

假设有下面的资源文件 test-map.txt

# 这是一行注释
foo=bar #这是行内注释

我们在代码中加载上面的文件内容到 Map 类型字段中:

@LoadResouce("test-map.txt")
private Map<String, String> testMap;

程序运行时会发现 testMap 中有两条记录: 

1. key="# 这是一行注释" val=null
2. key="foo", val="bar #这是行内注释"

很明显这不是程序需要的结果. #1146 增强了 Map 类型的加载逻辑, 现在运行程序, testMap 中只有一条记录: key="foo", val="bar"

#1145 第二次下载大 csv 文件会发生下载不完的问题

这是因为 ActFramework 在第一次下载采用常规方式进行之后侦测到响应过大, 因此以后该接口的写入响应方式都采用直接写 outputStream, 然而这个写入过程有逻辑错误, outputStream 被提前关闭了. #1145 修复了这个问题

#1144 CLI 异步报告进度条吃掉了大部分的 CPU

CLI 异步报告进度是个很 Nice 的特性:

然而老码农最近的项目实践中某个异步执行过程时间很长, 偶然发现 JVM 吃满了 CPU, 但这个异步过程有远端调用, 并不是 CPU 密集性. 调试后发现罪魁在  CLI 的进度报告上面:

#1144 修复了这个问题. 现在小伙伴们可以放心大胆使用 CLI 异步进度报告了. 悄悄说一下, 这个特性很容易使用, 这样写代码就可以:

    @Async // 声明为异步
    @ReportProgress // 要求 CLI 报告执行进度
    @Command(name = "calcPi", help = "calculate pi") // 声明这是一个 CLI 命令方法, 命令名字为 calcPi
    public double calcPi(
        @DefaultValue("99999999") @Optional int steps, // 命令可选参数, 使用 -s 或 --steps 指定
        ProgressGauge gauge // 注入一个进度报告器
    ){
        gauge.updateMaxHint(steps); // 更新进度预期步数
        double pi = 0.0d;
        for (int i = steps; i > 0; --i) {
            pi += Math.pow(-1, i + 1) / (2 * i - 1);
            if (i == 1) {
                pi *= 4;
                break;
            }
            gauge.step(); // 步进 1 次
        }
        return pi;
    }

2. Starters (act-starter-parent-1.8.24.0) 更新

  • act 更新到 1.8.24
  • act-beetl 更新到 1.5.3 - beetl 更新至 3.0.5.RELEASE
  • act-beetsql 更新到 1.5.11 - beetsql 更新至 2.12.5.RELEASE

3. maven-archetypes (1.8.24.1) 更新:

  • parent 更新到 act-starter-parent-1.8.24.0
  • 在 app.properties 模板中加入了 resource.filtering 的注释说明
  • 在 pom.xml 模板中加入了 jvm option 和 docker 配置参数说明

现在 maven-archetype 生成的新项目 pom.xml 是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycom.helloservice</groupId>
  <artifactId>helloservice</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>My Awesome Application</name>

  <parent>
    <groupId>org.actframework</groupId>
    <artifactId>act-starter-parent</artifactId>
    <version>1.8.24.0</version>
  </parent>

  <properties>
    <!-- remove the following line if you are on Java 7-->
    <java.version>1.8</java.version>
    <app.entry>com.mycom.helloservice.AppEntry</app.entry>

    <!-- tune your JVM arguments here
    <vmargs.heap.init>256M</vmargs.heap.init>
    <vmargs.heap.max>2G</vmargs.heap.max>
    <vmargs.extended />
    -->

    <!-- set your docker configuration here if needed
    <docker.repo>org.actframework/archetype-simple-restful-service</docker.repo>
    <docker.profile>prod</docker.profile>
    <docker.group>default</docker.group>
    <docker.http.port>5460</docker.http.port>
    <docker.cli.port>5461</docker.cli.port>
    <-->
  </properties>

  <dependencies>
    <!-- add your dependencies here -->
  </dependencies>

</project>

 

感谢关注 #ActFramework。最后看官若要问非苗条型是个什么东东? 此梗源自老码农博客: https://my.oschina.net/greenlaw110/blog/3065695

Guess you like

Origin www.oschina.net/news/107724/actframework-1-8-24-released