SealClassApplication.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.ym;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.mybatis.spring.annotation.MapperScan;
  4. import org.springframework.boot.SpringApplication;
  5. import org.springframework.boot.autoconfigure.SpringBootApplication;
  6. import org.springframework.boot.logging.LogLevel;
  7. import org.springframework.boot.logging.LoggingSystem;
  8. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  9. import org.springframework.cloud.client.loadbalancer.LoadBalanced;
  10. import org.springframework.cloud.openfeign.EnableFeignClients;
  11. import org.springframework.context.annotation.Bean;
  12. import org.springframework.context.annotation.ComponentScan;
  13. import org.springframework.context.annotation.Configuration;
  14. import org.springframework.context.annotation.EnableAspectJAutoProxy;
  15. import org.springframework.scheduling.annotation.EnableAsync;
  16. import org.springframework.scheduling.annotation.EnableScheduling;
  17. import org.springframework.web.client.RestTemplate;
  18. @EnableAspectJAutoProxy
  19. @Slf4j
  20. @SpringBootApplication
  21. @EnableFeignClients("com.ym.mec")
  22. @MapperScan(basePackages = {"com.ym.mec.biz.dal.dao", "com.ym.mec.biz.dal.mapper"})
  23. @ComponentScan(basePackages = {"com.ym", "com.mec.redisson", "com.yonge.log"})
  24. @EnableScheduling
  25. @EnableDiscoveryClient
  26. @Configuration
  27. @EnableAsync
  28. public class SealClassApplication {
  29. public static void main(String[] args) {
  30. SpringApplication.run(SealClassApplication.class, args);
  31. configureGlobalLogger();
  32. log.info("SealClassApplication started");
  33. }
  34. private static void configureGlobalLogger() {
  35. LoggingSystem loggingSystem = LoggingSystem.get(ClassLoader.getSystemClassLoader());
  36. // 设置业务日志记录器的日志级别为INFO
  37. loggingSystem.setLogLevel("businessLogger", LogLevel.INFO);
  38. }
  39. @Bean
  40. @LoadBalanced
  41. public RestTemplate restTemplate(){
  42. return new RestTemplate();
  43. }
  44. }