Commonly used annotations [spring java configuration] || springboot hot deployment

Common notes [spring java configuration]

Review the annotations of spring

@Controller

@RestController

@Service

@Repository

@Component

@RequestMapping @GetMaping @PostMapping @DeleteMapping @PutMapping

@PatchMapping

@Autowired

@RequestBody

@ResponseBody



Related notes

. 1 , @Configuration acts based on the equivalent of a xml configuration file; file application-dao.xml

2 , @Bean acting methods , the equivalent xml configuration <the bean> ;

3 , @Import notes after you create a profile you can introduce other profiles

          |--<import resource=”classpath:application-dao.xml”>

. 4 , @ComponentScan ( "com.sxt") configure the scan

           |--<content-compon-scan backpageage=””>

5 , @Qualifier notes, qualifier means that those who pass through this label, which indicates that the implementation class is what we need, we modify the calling code, add @Qualifier annotations should be noted that @Qualifier parameter name must We defined one of the names of @Bean annotation before

6 , @Primary mainly when there are multiple objects in the IOC container, then there will be conflicts, you can use this annotation to mark it as the main object of use



About Bean supplement

When there Bean annotated method when the parameter form , the object will be taken inside the container IOC default annotation has such a @Autowired



springboot hot deployment

Do not restart the project after modifying the code or configuration file

Published 529 original articles · praised 115 · 90,000 views

Guess you like

Origin blog.csdn.net/qq_39368007/article/details/105602507