标签:record 注解 get config ali vat data ble 统一
@SpringBootApplication:@Configuration + @EnableAutoConfiguration + @ComponentScan
@SpringBootApplication
public class AfvappApplication {
public static void main(String[] args) {
SpringApplication.run(AfvappApplication.class, args);
}
}
@Controller:类注解,控制器层,类中方法配合@RequestMapping
@RestController:类注解,控制器层,REST风格,@Controller + @ResponseBody
@RestController
@RequestMapping("/demo")
public class DemoController {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello() { ... }
}
@Repository:确保DAO或者repositories提供异常转译
@Repository
public interface SqlserverMapper {
List<String> listVerifyRecords();
}
@Qualifier:@Qualifier(“name”) + @Autowired
@Resource:
@Autowired
@Qualifier(value = "sqlserverDataSource")
private DataSource sqlserverDataSource;
@Resource(name = "yt_MATHandleServiceImpl")
private MATHandleService ytService;
@Resource(name = "cw_MATHandleServiceImpl")
private MATHandleService cwService;
全局异常处理
@ControllerAdvice:包含@Component,可以被扫描到,统一处理异常
@ExceptionHandler(Exception.class):方法注解,表示遇到该异常就执行以下方法
其他注解
@Service:类注解,服务层
@Component:泛指组件
标签:record 注解 get config ali vat data ble 统一
原文地址:https://www.cnblogs.com/wjcx-sqh/p/12708253.html