SpringBoot统一响应及全局异常处理框架 -- lihansir-spring-boot-starter
Make the development of API services faster and more efficient (Only for springboot)1、If you want to use request uniform responseIntroducing dependencies to your pom.xml
12345<dependency> <groupId>com.lihansir.platform</groupId> <artifactId>lihansir-spring-boot-starter</artifactId> <version>${latest version}</version> </dependency>
click here to find the latest version
Alternate link
Just need two annotation
12@EnableRestResult ...
SpringBoot 解决跨域问题
1、@CrossOrigin注解解决跨域
123456@GetMapping("/hello")@ResponseBody@CrossOrigin(value = "*")public String hello() { return "hello";}
2、接口编程
123456789101112@Configurationpublic class WebConfigurer implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedHeaders("*") .allowedMethods("*") .allowCredentials(true) .allowedOriginPatterns("*") ...