Spring Annotations

@SpringBootApplication

@SpringBootConfiguration

@EnableAutoConfiguration

@ComponentScan

@Component for any Spring-managed component, scanned by

to respect the convention:

@Repository for persistence layer – deal with DataAccessException

@Service for service layer

@Controller for presentation layer (spring-mvc) – the dispatcher scans the classes annotated with @Controller and detects @RequestMapping annotations within them. We can only use @RequestMapping on @Controller

@EnableWebMvc

@RestController – The Controller only sends back the model (or resource representation) – @Controller + @ResponseBody

@RequestBody – convert incoming JSON

@ResponseBody – annotation means is that the returned value of the method will constitute the body of the HTTP response of accounts is transformed to a format suitable for REST applications, typically JSON or XML

@RequestMapping – mapping web requests onto methods in request-handling classes (produces = MediaType.APPLICATION_JSON_UTF8_VALUE)

@RunWith

@SpringBootTest

@AutoConfigureMockMvc

@Transactional – start transaction (see Transaction propagations in Spring)

@ModelAttribute

@PathVariable

@Scope

@PostConstruct

@PreDestroy

@Profile

Leave a comment

Your email address will not be published. Required fields are marked *