Created
June 5, 2018 19:38
-
-
Save imasahiro/51c0ca0ab4331b2c324babdf4e198a62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Configuration { | |
@Bean | |
HttpServiceRegistrationBean springMvcTomcatService(ServletWebServerApplicationContext applicationContext) { | |
TomcatWebServer container = (TomcatWebServer) applicationContext.getWebServer(); | |
// Starts the container explicitly to make sure all connectors are write back from serviceConnectors. | |
container.start(); | |
Connector tomcatConnector = container.getTomcat().getConnector(); | |
return new HttpServiceRegistrationBean() | |
.setServiceName("MyService") | |
.setService(TomcatService.forConnector(tomcatConnector) | |
.decorate(LoggingService.newDecorator())) | |
.setPathMapping(PathMapping.ofPrefix(endpointPrefix)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment