214ccc9222516374b91235df1c2f1730aebafb21.svn-base 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package org.jeecg;
  2. import org.jeecg.loader.DynamicRouteLoader;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.boot.CommandLineRunner;
  5. import org.springframework.boot.SpringApplication;
  6. import org.springframework.boot.autoconfigure.SpringBootApplication;
  7. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  8. import org.springframework.cloud.openfeign.EnableFeignClients;
  9. import org.springframework.context.ConfigurableApplicationContext;
  10. import javax.annotation.Resource;
  11. /**
  12. * @author jeecg
  13. */
  14. @EnableFeignClients
  15. @EnableDiscoveryClient
  16. @SpringBootApplication
  17. public class JeecgGatewayApplication implements CommandLineRunner {
  18. @Resource
  19. private DynamicRouteLoader dynamicRouteLoader;
  20. public static void main(String[] args) {
  21. ConfigurableApplicationContext applicationContext = SpringApplication.run(JeecgGatewayApplication.class, args);
  22. String userName = applicationContext.getEnvironment().getProperty("jeecg.test");
  23. System.err.println("user name :" +userName);
  24. }
  25. /**
  26. * 容器初始化后加载路由
  27. * @param strings
  28. */
  29. @Override
  30. public void run(String... strings) {
  31. dynamicRouteLoader.refresh();
  32. }
  33. }