我想使用Springs new reactive webflux扩展在客户端和服务器应用程序之间建立通信.
对于依赖管理,我使用gradle.我在服务器上以及客户端上的build.gradle文件基本上是:
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.BUILD-SNAPSHOT")
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
dependencies {
compile("org.springframework.boot:spring-boot-starter-webflux")
}
Run Code Online (Sandbox Code Playgroud)
(应该注意的是2.0.0.BUILD- SNAPSHOT是一个移动目标,由于依赖内部的变化,手头的问题可能会消失一天)
当我启动服务器端应用程序时,一切都启动良好,包括启动嵌入式网络服务器.
但是当启动客户端应用程序时,也启动了一个netty服务器,导致"java.net.BindException:Address in in use",因为clientside netty服务器在与serverside netty服务器相同的端口上进行侦听.
我的问题是:为什么netty首先在客户端启动,我该如何防止它?
根据Spring-Boot文档,Spring尝试确定是否需要Web支持并相应地配置Spring Application上下文.
根据Docs,可以通过调用setWebEnvironment(false)来覆盖它.我的客户端启动代码如下所示:
@SpringBootApplication(scanBasePackages = { "com.tatics.flux.main" })
public class Client {
public static void main(String[] args) throws Exception {
SpringApplication app …Run Code Online (Sandbox Code Playgroud) 我正在尝试将现有的 Vaadin 8 应用程序迁移到 Vaadin 12,并且需要知道如何在 Vaadin 12 中重新创建 Vaadin 8 的 GridLayout 的功能。
根据Vaadin Docs的说法,可以在 Vaadin 12 中通过以下方式替换 GridLayout: “将 Div 与大多数浏览器支持的新 CSS 网格功能一起使用”
不幸的是,目前尚不完全清楚如何做到这一点。
让我们假设我有一个 Vaadin 复合“HelloGrid”:
@StyleSheet("styles/hello-grid.css")
public class HelloGrid extends Composite<Div> {
public HelloGrid(){
// EDIT: This line is my solution to the question
getElement().getClassList().add("hello-grid");
Label labelOne = new Label();
labelOne.addClassName("label-one");
Label labelTwo = new Label();
labelTwo.addClassName("label-two");
add(labelOne);
add(labelTwo);
}
}
Run Code Online (Sandbox Code Playgroud)
还有一个 css 文件“hello-grid.css”:
.hello-grid {
display: grid !important;
grid-template-rows: …Run Code Online (Sandbox Code Playgroud)