MaxKeyMgtApplication.java 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.synchronizer",
  42. "org.maxkey.web",
  43. "org.maxkey.web.access.contorller",
  44. "org.maxkey.web.api.endpoint",
  45. "org.maxkey.web.apps.contorller",
  46. "org.maxkey.web.contorller",
  47. "org.maxkey.web.endpoint",
  48. "org.maxkey.web.interceptor",
  49. "org.maxkey.web.permissions.contorller",
  50. "org.maxkey.web.tag"
  51. })
  52. @MapperScan("org.maxkey.persistence.mapper,")
  53. @SpringBootApplication
  54. @EnableDiscoveryClient
  55. public class MaxKeyMgtApplication extends SpringBootServletInitializer {
  56. private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtApplication.class);
  57. public static void main(String[] args) {
  58. _logger.info("Start MaxKeyMgtApplication ...");
  59. ConfigurableApplicationContext applicationContext =
  60. SpringApplication.run(MaxKeyMgtApplication.class, args);
  61. InitializeContext initWebContext = new InitializeContext(applicationContext);
  62. try {
  63. initWebContext.init(null);
  64. } catch (ServletException e) {
  65. _logger.error("Exception ",e);
  66. }
  67. _logger.info("MaxKeyMgt at {}" , new DateTime());
  68. _logger.info("MaxKeyMgt Server Port {}"
  69. ,applicationContext.getBean(ApplicationConfig.class).getPort());
  70. _logger.info("MaxKeyMgt started.");
  71. }
  72. protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  73. return application.sources(MaxKeyMgtApplication.class);
  74. }
  75. }