You have the following classes in your project:
Java
- the
Configclass located in theorg.hyperskill.configpackage;
@Configuration
public class Config {
@Bean
public String bean(){
return "bean";
}
}
- the
ExampleServiceclass in theorg.hyperskill.servicepackage;
@Service
public class ExampleService {
}
- the
ExampleComponentclass in theotherpackagepackage;
@Component
public class ExampleComponent {
}
- the
Applicationclass for running a Spring Boot application.
@SpringBootApplication
public class Application {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
}
}
Kotlin
- the
Configclass located in theorg.hyperskill.configpackage;
@Configuration
open class Config {
@Bean
open fun bean(): String = "bean"
}
- the
ExampleServiceclass in theorg.hyperskill.servicepackage;
@Service
open class ExampleService {
}
- the
ExampleComponentclass in theotherpackagepackage;
@Component
open class ExampleComponent {
}
- the
Applicationclass for running a Spring Boot application.
@SpringBootApplication
open class Application
fun main(args: Array<String>) {
val context = SpringApplication.run(Application::class.java, *args)
}
Here is the project structure for convenience:
Which beans will be contained in context?