@@ -12,54 +12,7 @@ annotated class, indicating its role as a web component.
12
12
To enable auto-detection of such `@Controller` beans, you can add component scanning to
13
13
your Java configuration, as the following example shows:
14
14
15
- [tabs]
16
- ======
17
- Java::
18
- +
19
- [source,java,indent=0,subs="verbatim,quotes",role="primary"]
20
- ----
21
- @Configuration
22
- @ComponentScan("org.example.web")
23
- public class WebConfig {
24
-
25
- // ...
26
- }
27
- ----
28
-
29
- Kotlin::
30
- +
31
- [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
32
- ----
33
- @Configuration
34
- @ComponentScan("org.example.web")
35
- class WebConfig {
36
-
37
- // ...
38
- }
39
- ----
40
- ======
41
-
42
- The following example shows the XML configuration equivalent of the preceding example:
43
-
44
- [source,xml,indent=0,subs="verbatim,quotes"]
45
- ----
46
- <?xml version="1.0" encoding="UTF-8"?>
47
- <beans xmlns="http://www.springframework.org/schema/beans"
48
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
49
- xmlns:p="http://www.springframework.org/schema/p"
50
- xmlns:context="http://www.springframework.org/schema/context"
51
- xsi:schemaLocation="
52
- http://www.springframework.org/schema/beans
53
- https://www.springframework.org/schema/beans/spring-beans.xsd
54
- http://www.springframework.org/schema/context
55
- https://www.springframework.org/schema/context/spring-context.xsd">
56
-
57
- <context:component-scan base-package="org.example.web"/>
58
-
59
- <!-- ... -->
60
-
61
- </beans>
62
- ----
15
+ include-code::./WebConfiguration[tag=snippet,indent=0]
63
16
64
17
`@RestController` is a xref:core/beans/classpath-scanning.adoc#beans-meta-annotations[composed annotation] that is
65
18
itself meta-annotated with `@Controller` and `@ResponseBody` to indicate a controller whose
0 commit comments