Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify code and config #7840

Merged
merged 14 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,13 @@
@Component
public class BenchmarkController {

private static final Mono<ServerResponse> EMPTY_RESPONSE = ServerResponse.ok()
.contentType(MediaType.TEXT_PLAIN)
.headers(h -> {
h.remove(HttpHeaders.SERVER);
h.remove(HttpHeaders.CONNECTION);
})
.build().share();


@Bean
public RouterFunction<ServerResponse> routes() {
return route()
.GET("/", request -> EMPTY_RESPONSE)
.GET("/user/{id}", request -> ServerResponse.ok()
.contentType(MediaType.TEXT_PLAIN)
.headers(h -> {
h.remove(HttpHeaders.SERVER);
h.remove(HttpHeaders.CONNECTION);
})
.bodyValue(request.pathVariable("id")))
.POST("/user", request -> EMPTY_RESPONSE)
.GET("/", request -> ServerResponse.ok().bodyValue(""))
.GET("/user/{id}", request -> ServerResponse.ok().bodyValue(request.pathVariable("id")))
.POST("/user", request -> ServerResponse.ok().bodyValue(""))
.build();
}

}
}
18 changes: 3 additions & 15 deletions java/spring-webflux/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
server.port=3000
spring.main.banner-mode=off
server.error.whitelabel.enabled=false
logging.level.root=WARN
server.http2.enabled=true
spring.threads.virtual.enabled=true
spring.main.lazy-initialization=true
spring.main.keep-alive=true
server.netty.validate-headers=false
server.netty.connection-timeout=5s
server.netty.idle-timeout=30s
server.netty.h2c-max-content-length=1MB
server.netty.initial-buffer-size=64KB
server.netty.max-initial-line-length=8KB
server.netty.max-keep-alive-requests=1000
logging.level.root=ERROR
spring.netty.leak-detection=disabled
server.compression.min-response-size=1KB
server.compression.enabled=true
spring.reactor.netty.shutdown-quiet-period=0s
server.netty.validate-headers=false
Loading