mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.5.x' into 4.0.x
Closes gh-50217
This commit is contained in:
@@ -118,6 +118,7 @@ dependencies {
|
||||
implementation(project(path: ":module:spring-boot-jackson"))
|
||||
implementation(project(path: ":module:spring-boot-jdbc"))
|
||||
implementation(project(path: ":module:spring-boot-jdbc-test"))
|
||||
implementation(project(path: ":module:spring-boot-jetty"))
|
||||
implementation(project(path: ":module:spring-boot-jooq-test"))
|
||||
implementation(project(path: ":module:spring-boot-jpa"))
|
||||
implementation(project(path: ":module:spring-boot-jms"))
|
||||
|
||||
@@ -679,8 +679,8 @@
|
||||
* xref:how-to:webserver.adoc#howto.webserver.disable[#howto.webserver.disable]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.discover-port[#howto-discover-the-http-port-at-runtime]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.discover-port[#howto.webserver.discover-port]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-multiple-connectors-in-tomcat[#howto-enable-multiple-connectors-in-tomcat]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-multiple-connectors-in-tomcat[#howto.webserver.enable-multiple-connectors-in-tomcat]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-multiple-connectors.tomcat[#howto-enable-multiple-connectors-in-tomcat]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-multiple-connectors.tomcat[#howto.webserver.enable-multiple-connectors-in-tomcat]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-response-compression[#how-to-enable-http-response-compression]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-response-compression[#howto.webserver.enable-response-compression]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.enable-tomcat-mbean-registry[#howto-enable-tomcat-mbean-registry]
|
||||
|
||||
@@ -547,8 +547,13 @@ You can take complete control of the configuration of Tomcat's javadoc:org.apach
|
||||
|
||||
|
||||
|
||||
[[howto.webserver.enable-multiple-connectors-in-tomcat]]
|
||||
== Enable Multiple Connectors with Tomcat
|
||||
[[howto.webserver.enable-multiple-connectors]]
|
||||
== Enable Multiple Connectors
|
||||
|
||||
|
||||
|
||||
[[howto.webserver.enable-multiple-connectors.tomcat]]
|
||||
=== Multiple Connectors with Tomcat
|
||||
|
||||
You can add an javadoc:org.apache.catalina.connector.Connector[] to the javadoc:org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory[], which can allow multiple connectors, including HTTP and HTTPS connectors, as shown in the following example:
|
||||
|
||||
@@ -556,6 +561,15 @@ include-code::MyTomcatConfiguration[]
|
||||
|
||||
|
||||
|
||||
[[howto.webserver.enable-multiple-connectors.jetty]]
|
||||
=== Multiple Connectors with Jetty
|
||||
|
||||
You can register additional Jetty javadoc:org.eclipse.jetty.server.Connector[] instances by adding a javadoc:org.springframework.boot.jetty.JettyServerCustomizer[] on the javadoc:org.springframework.boot.jetty.ConfigurableJettyWebServerFactory[], as shown in the following example:
|
||||
|
||||
include-code::MyJettyConfiguration[]
|
||||
|
||||
|
||||
|
||||
[[howto.webserver.enable-tomcat-mbean-registry]]
|
||||
== Enable Tomcat's MBean Registry
|
||||
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectors.jetty;
|
||||
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
||||
import org.springframework.boot.jetty.ConfigurableJettyWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyJettyConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory> connectorCustomizer() {
|
||||
return (jetty) -> jetty.addServerCustomizers((server) -> {
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
connector.setPort(8081);
|
||||
server.addConnector(connector);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectorsintomcat;
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectors.tomcat;
|
||||
|
||||
import org.apache.catalina.connector.Connector;
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectors.jetty
|
||||
|
||||
import org.eclipse.jetty.server.Server
|
||||
import org.eclipse.jetty.server.ServerConnector
|
||||
import org.springframework.boot.jetty.ConfigurableJettyWebServerFactory
|
||||
import org.springframework.boot.jetty.JettyServerCustomizer
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MyJettyConfiguration {
|
||||
|
||||
@Bean
|
||||
fun connectorCustomizer(): WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory> {
|
||||
return WebServerFactoryCustomizer { jetty: ConfigurableJettyWebServerFactory ->
|
||||
jetty.addServerCustomizers(JettyServerCustomizer { server: Server ->
|
||||
val connector = ServerConnector(server)
|
||||
connector.setPort(8081)
|
||||
server.addConnector(connector)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectorsintomcat
|
||||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectors.tomcat
|
||||
|
||||
import org.apache.catalina.connector.Connector
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer
|
||||
@@ -39,4 +39,3 @@ class MyTomcatConfiguration {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user