jabrena / SpringCloudLab

SpringCloud examples
MIT License
0 stars 1 forks source link

Learn the concepts about the most popular annotations #18

Closed jabrena closed 8 years ago

jabrena commented 8 years ago

Main program:

@SpringBootApplication The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-using-springbootapplication-annotation.html

@ComponentScan https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html http://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch06s02.html http://techidiocy.com/annotation-config-vs-component-scan-spring-core/ component-scan : Component scan can do everything that annotation config does , in addition to it it also registers the java classes as spring bean those are annotated with @Component , @Service ,@Repository etc.

@EnableAutoConfiguration Spring Boot auto-configuration attempts to automatically configure your Spring application based on the jar dependencies that you have added. http://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/EnableAutoConfiguration.html https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-auto-configuration.html

Controller:

@RestController @RequestMapping("hello")

jabrena commented 8 years ago

import lombok.extern.slf4j.Slf4j;

@Slf4j

https://github.com/ojacquemart/spring-boot-rxjava/blob/master/src/main/java/com/ojacquemart/reactive/github/service/RestClient.java