2015-03-25 14:39:26 +00:00
|
|
|
|
### 64.13. 启用Undertow的多监听器(Multiple Listeners)
|
2015-03-23 16:32:35 +00:00
|
|
|
|
|
2015-03-25 14:39:26 +00:00
|
|
|
|
往`UndertowEmbeddedServletContainerFactory`添加一个`UndertowBuilderCustomizer`,然后添加一个监听者到`Builder`:
|
2015-03-23 16:32:35 +00:00
|
|
|
|
```java
|
2015-03-25 14:39:26 +00:00
|
|
|
|
@Bean
|
|
|
|
|
public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
|
|
|
|
|
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
|
|
|
|
|
factory.addBuilderCustomizers(new UndertowBuilderCustomizer() {
|
2015-03-23 16:32:35 +00:00
|
|
|
|
|
2015-03-25 14:39:26 +00:00
|
|
|
|
@Override
|
|
|
|
|
public void customize(Builder builder) {
|
|
|
|
|
builder.addHttpListener(8080, "0.0.0.0");
|
|
|
|
|
}
|
2015-03-23 16:32:35 +00:00
|
|
|
|
|
2015-03-25 14:39:26 +00:00
|
|
|
|
});
|
|
|
|
|
return factory;
|
2015-03-23 16:32:35 +00:00
|
|
|
|
}
|
|
|
|
|
```
|