pcyuen98 / covidAngular

0 stars 0 forks source link

Spring Boot Configuration #33

Closed pcyuen98 closed 3 years ago

pcyuen98 commented 3 years ago

Research as per topic above and provide reference link. It should contain the 2 annotation and services as below

@EnableAutoConfiguration @ComponentScan

abdrhm293 commented 3 years ago

In Spring Boot, we can use Spring Framework to define our beans and their dependency injection. The @ComponentScan annotation is used to find beans and the corresponding injected with @Autowired annotation. If you followed the Spring Boot typical layout, no need to specify any arguments for @ComponentScan annotation. https://www.tutorialspoint.com/spring_boot/spring_boot_beans_and_dependency_injection.htm

The @EnableAutoConfiguration annotation enables Spring Boot to auto-configure the application context. Therefore, it automatically creates and registers beans based on both the included jar files in the classpath and the beans defined by us. https://www.baeldung.com/spring-componentscan-vs-enableautoconfiguration