MaxKeyMgtApplication.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
  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 org.maxkey;
  17. import javax.servlet.ServletException;
  18. import org.joda.time.DateTime;
  19. import org.maxkey.configuration.ApplicationConfig;
  20. import org.maxkey.web.InitializeContext;
  21. import org.mybatis.spring.annotation.MapperScan;
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.springframework.boot.SpringApplication;
  25. import org.springframework.boot.autoconfigure.SpringBootApplication;
  26. import org.springframework.boot.builder.SpringApplicationBuilder;
  27. import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  28. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  29. import org.springframework.context.ConfigurableApplicationContext;
  30. import org.springframework.context.annotation.ComponentScan;
  31. @ComponentScan(basePackages = {
  32. "org.maxkey.authn",
  33. "org.maxkey.configuration",
  34. "org.maxkey.entity",
  35. "org.maxkey.entity.apps",
  36. "org.maxkey.entity.userinfo",
  37. "org.maxkey.identity.kafka",
  38. "org.maxkey.identity.rest",
  39. "org.maxkey.identity.scim.controller",
  40. "org.maxkey.persistence",
  41. "org.maxkey.provision",
  42. "org.maxkey.synchronizer",
  43. "org.maxkey.web",
  44. "org.maxkey.web.access.contorller",
  45. "org.maxkey.web.api.endpoint",
  46. "org.maxkey.web.apps.contorller",
  47. "org.maxkey.web.contorller",
  48. "org.maxkey.web.endpoint",
  49. "org.maxkey.web.interceptor",
  50. "org.maxkey.web.permissions.contorller",
  51. "org.maxkey.web.tag"
  52. })
  53. @MapperScan("org.maxkey.persistence.mapper,")
  54. @SpringBootApplication
  55. @EnableDiscoveryClient
  56. public class MaxKeyMgtApplication extends SpringBootServletInitializer {
  57. private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtApplication.class);
  58. public static void main(String[] args) {
  59. _logger.info("Start MaxKeyMgt Application ...");
  60. ConfigurableApplicationContext applicationContext =
  61. SpringApplication.run(MaxKeyMgtApplication.class, args);
  62. InitializeContext initWebContext = new InitializeContext(applicationContext);
  63. try {
  64. initWebContext.init(null);
  65. } catch (ServletException e) {
  66. _logger.error("Exception ",e);
  67. }
  68. _logger.info("MaxKeyMgt at {}" , new DateTime());
  69. _logger.info("MaxKeyMgt Server Port {}"
  70. ,applicationContext.getBean(ApplicationConfig.class).getPort());
  71. _logger.info("MaxKeyMgt started.");
  72. }
  73. protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  74. return application.sources(MaxKeyMgtApplication.class);
  75. }
  76. }