UserCenterApplication.java 1.5 KB

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