SaleApplication.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.fdkankan.sale;
  2. import com.fdkankan.sale.common.CacheUtil;
  3. import org.mybatis.spring.annotation.MapperScan;
  4. import org.springframework.beans.factory.annotation.Value;
  5. import org.springframework.boot.CommandLineRunner;
  6. import org.springframework.boot.SpringApplication;
  7. import org.springframework.boot.autoconfigure.SpringBootApplication;
  8. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  9. import org.springframework.context.annotation.ComponentScan;
  10. import org.springframework.scheduling.annotation.EnableScheduling;
  11. import org.springframework.transaction.annotation.EnableTransactionManagement;
  12. @SpringBootApplication
  13. @EnableTransactionManagement//开启事务
  14. @EnableDiscoveryClient
  15. @EnableScheduling
  16. @ComponentScan(basePackages = {"com.fdkankan.*"})
  17. @MapperScan("com.fdkankan.**.mapper")
  18. public class SaleApplication implements CommandLineRunner {
  19. @Value("${spring.profiles.active}")
  20. private String environment;
  21. @Value("${fyun.type}")
  22. private String uploadType;
  23. @Value("${fyun.bucket}")
  24. private String bucket;
  25. @Value("${fyun.host}")
  26. private String host;
  27. @Value("${main.url}")
  28. private String mainUrl;
  29. public static void main(String[] args) {
  30. SpringApplication.run(SaleApplication.class, args);
  31. }
  32. @Override
  33. public void run(String... args) throws Exception {
  34. CacheUtil.uploadType = uploadType;
  35. CacheUtil.bucket = bucket;
  36. CacheUtil.environment = environment;
  37. CacheUtil.host = host;
  38. CacheUtil.mainUrl = mainUrl;
  39. }
  40. }