菜鸟的springboot常用注解总结
说明
@SpringBootApplication
@Component、@Service、@Controller、@Repository
@ResponseBody
@RestController
@AutoWired、@Qualifier、@Resource
@RequestMapping、@GetMapping、@PostMapping
@Value、@ConfigurationProperties、@PropertySource
@Configuration、@Bean
@RequestParam、@RequestBody、@PathVariable、@RequestHeader、@CookieValue
@ConfigurationProperties
该注解可以直接注入整个类的数据,作用于类
配置文件如下,这里使用pro环境
测试
@PropertySource
注意:@PropertySource不支持yml文件读取。
配置文件如下:people.properties