我正在设计一个生成CSV测试数据的小工具.我想使用Akka Streams(1.0-RC4)来实现数据流.将有一个Source生成随机数,转换为CSV字符串,一些速率限制器和一个写入文件的接收器.
还应该有一个使用小型REST接口停止工具的干净方法.
这是我在努力的地方.流启动后(RunnableFlow.run())似乎无法阻止它.Source和Sink是无限的(至少在磁盘运行完全:) :)所以他们不会停止流.
向Source或Sink添加控制逻辑感觉不对.也使用ActorSystem.shutdown().什么是阻止流的好方法?
我正在尝试编写一个可重复使用的项目选择面板,其中用户具有可以从中选择的项目的网格以及可用于过滤网格内容的小文本字段.现在,(简化的)视图代码看起来像这样并且有效.
Ext.define('MyApp.view.items.ItemSelectorPanel', {
extend: 'Ext.panel.Panel',
require: 'MyApp.view.items.SimpleItemGrid',
alias: 'widget.ItemSelectorPanel',
layout: 'form',
config: {
itemStore: false
},
constructor: function(config) {
this.initConfig(config);
this.superclass.constructor.call(this, config);
this.add([
{
fieldLabel: 'Filter',
name: 'filter'
},
{
xtype: 'SimpleItemGrid',
collapsible: true,
store: this.getItemStore()
}
]);
return this;
}
});
Run Code Online (Sandbox Code Playgroud)
如您所见,ItemSelectorPanel使用该config属性公开一个接口,其中调用站点可以指定要使用的项目存储.
呼叫站点(在这种情况下,面板被添加到TabPanel):
var panelToAdd = {
xtype: 'panel',
title: 'New Selection',
closable: true,
padding: 10,
items: [{
title: 'Select node',
xtype: 'ItemSelectorPanel',
itemStore: itemStore
}]
};
Run Code Online (Sandbox Code Playgroud)
现在,我喜欢ExtJS 4的声明式风格以及它如何帮助遵循MVC模式.我希望在视图中可以使用最少量的代码.不幸的是,这不起作用:
Ext.define('MyApp.view.items.ItemSelectorPanel', { …Run Code Online (Sandbox Code Playgroud) 我正在使用 Spring Boot 2.0.1 和 WebFlux 路由器功能(不是基于注释!)编写一个应用程序。对于我的一些数据对象,我编写了扩展的自定义序列化器StdSerializer。我将它们注册在 a 中SimpleModule并将该模块公开为 bean。
当我运行该应用程序时,此设置非常有效。该 bean 已实例化,并且使用正确的序列化器序列化 REST 响应。
现在我想编写一个测试来验证路由器功能及其背后的处理程序是否按预期工作。我想模拟的处理程序背后的服务。但是,在测试中,REST 响应使用默认序列化器。
我创建了一个小型演示项目来重现该问题。完整代码可以在这里找到:http://s000.tinyupload.com/? file_id=82815835861287011625
Gradle 配置加载 Spring Boot 和一些依赖项来支持 WebFlux 和测试。
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin
import org.springframework.boot.gradle.plugin.SpringBootPlugin
buildscript {
ext {
springBootVersion = '2.0.1.RELEASE'
}
repositories {
mavenCentral()
// To allow to pull in milestone releases from Spring
maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: SpringBootPlugin
apply plugin: …Run Code Online (Sandbox Code Playgroud)