mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Extract code snippets from logging.adoc
See gh-36175
This commit is contained in:
@@ -25,62 +25,7 @@ through the `enableLoggingRequestDetails` property on `DispatcherServlet`.
|
||||
|
||||
The following example shows how to do so by using Java configuration:
|
||||
|
||||
[tabs]
|
||||
======
|
||||
Java::
|
||||
+
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
public class MyInitializer
|
||||
extends AbstractAnnotationConfigDispatcherServletInitializer {
|
||||
|
||||
@Override
|
||||
protected Class<?>[] getRootConfigClasses() {
|
||||
return ... ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?>[] getServletConfigClasses() {
|
||||
return ... ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getServletMappings() {
|
||||
return ... ;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
|
||||
registration.setInitParameter("enableLoggingRequestDetails", "true");
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
class MyInitializer : AbstractAnnotationConfigDispatcherServletInitializer() {
|
||||
|
||||
override fun getRootConfigClasses(): Array<Class<*>>? {
|
||||
return ...
|
||||
}
|
||||
|
||||
override fun getServletConfigClasses(): Array<Class<*>>? {
|
||||
return ...
|
||||
}
|
||||
|
||||
override fun getServletMappings(): Array<String> {
|
||||
return ...
|
||||
}
|
||||
|
||||
override fun customizeRegistration(registration: ServletRegistration.Dynamic) {
|
||||
registration.setInitParameter("enableLoggingRequestDetails", "true")
|
||||
}
|
||||
}
|
||||
----
|
||||
======
|
||||
include-code::./MyInitializer[tag=snippet,indent=0]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user