SceneApplication.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.fdkankan.scene;
  2. import com.fdkankan.common.config.ShiroConfig;
  3. import com.fdkankan.common.exception.GlobalExceptionHandler;
  4. import com.fdkankan.common.jwt.JwtFilter;
  5. import com.fdkankan.common.response.ResultData;
  6. import com.fdkankan.scene.dto.TestDto;
  7. import org.springframework.boot.SpringApplication;
  8. import org.springframework.boot.autoconfigure.SpringBootApplication;
  9. import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  10. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  11. import org.springframework.context.annotation.Bean;
  12. import org.springframework.web.bind.annotation.PostMapping;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RestController;
  15. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  16. @RestController
  17. @EnableDiscoveryClient
  18. public class SceneApplication {
  19. public static void main(String[] args) {
  20. SpringApplication.run(SceneApplication.class, args);
  21. }
  22. /**
  23. * 注入全局异常处理器
  24. */
  25. @Bean
  26. public GlobalExceptionHandler globalExceptionHandler(){
  27. return new GlobalExceptionHandler();
  28. }
  29. @PostMapping("/api/user/test/test")
  30. public ResultData test(@RequestBody TestDto test){
  31. System.out.println("进入了");
  32. if(test.getName().equals("aaa")){
  33. // throw new BusinessException(1000,"asdfaswdfasdfsdf");
  34. int i = test.getId() / 0;
  35. }
  36. return ResultData.ok(test);
  37. }
  38. }