Suppose that the configuration class Config is placed in the com.mycompany.config package.
Java
package com.mycompany.config;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(???)
public class Config {
// some code
}
Kotlin
package com.mycompany.config
import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(???)
open class Config {
// some code
}
Also, there are @Repository classes inside the com.mycompany.repository package and @Service classes inside the com.mycompany.service package.
What attribute can be used in the @ComponentScan annotation over the Config class to make the Config class aware of all these services and repositories? You have the following options:
Java
A) @ComponentScan(basePackages = "com.mycompany")
B) @ComponentScan doesn't require an attribute
C) @ComponentScan(basePackages = {"com.mycompany.repository", "com.mycompany.service"})
D) @ComponentScan("com.mycompany")
Kotlin
A) @ComponentScan(basePackages = ["com.mycompany"])
B) @ComponentScan doesn't require an attribute
C) @ComponentScan(basePackages = ["com.mycompany.repository", "com.mycompany.service"])
D) @ComponentScan("com.mycompany")