Spring Boot components

Report a typo

You have the following classes in your project:

Java
  • the Config class located in the org.hyperskill.config package;
@Configuration
public class Config {

    @Bean
    public String bean(){
        return "bean";
    }
}
  • the ExampleService class in the org.hyperskill.service package;
@Service
public class ExampleService {

}
  • the ExampleComponent class in the otherpackage package;
@Component
public class ExampleComponent {

}
  • the Application class 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 Config class located in the org.hyperskill.config package;
@Configuration
open class Config {
    @Bean
    open fun bean(): String = "bean"
}
  • the ExampleService class in the org.hyperskill.service package;
@Service
open class ExampleService {

}
  • the ExampleComponent class in the otherpackage package;
@Component
open class ExampleComponent {

}
  • the Application class 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:

Spring project structure

Which beans will be contained in context?

Select one option from the list
___

Create a free account to access the full topic