547bff0b0c2706b7636f7143e9f00eb71e0864ef.svn-base 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 1999-2018 Alibaba Group Holding Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.alibaba.csp.sentinel.dashboard;
  17. import org.springframework.boot.SpringApplication;
  18. import org.springframework.boot.autoconfigure.SpringBootApplication;
  19. import org.springframework.context.ConfigurableApplicationContext;
  20. import org.springframework.core.env.Environment;
  21. import com.alibaba.csp.sentinel.init.InitExecutor;
  22. import lombok.extern.slf4j.Slf4j;
  23. /**
  24. * Sentinel dashboard application.
  25. *
  26. * @author Carpenter Lee
  27. */
  28. @SpringBootApplication
  29. @Slf4j
  30. public class JeecgSentinelDashboardApplication {
  31. public static void main(String[] args) {
  32. System.setProperty("csp.sentinel.app.type", "1");
  33. triggerSentinelInit();
  34. ConfigurableApplicationContext application = SpringApplication.run(JeecgSentinelDashboardApplication.class, args);
  35. Environment env = application.getEnvironment();
  36. String port = env.getProperty("server.port");
  37. log.info("\n----------------------------------------------------------\n\t" +
  38. "Application SentinelDashboard is running! Access URLs:\n\t" +
  39. "Local: \t\thttp://localhost:" + port + "/\n\t" +
  40. "----------------------------------------------------------");
  41. }
  42. private static void triggerSentinelInit() {
  43. new Thread(() -> InitExecutor.doInit()).start();
  44. }
  45. }