d9a0a118bacabacfc2856b79537daa1823ea6f14.svn-base 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //package cn.com.goldenwater.dcproj.interceptor;
  2. //
  3. //import cn.com.goldenwater.license.LicenseVerify;
  4. //import cn.com.goldenwater.license.LicenseVerifyParam;
  5. //import org.apache.commons.lang3.StringUtils;
  6. //import org.slf4j.Logger;
  7. //import org.slf4j.LoggerFactory;
  8. //import org.springframework.beans.factory.annotation.Value;
  9. //import org.springframework.context.ApplicationListener;
  10. //import org.springframework.context.event.ContextRefreshedEvent;
  11. //import org.springframework.stereotype.Component;
  12. //
  13. ///**
  14. // * 在项目启动时安装证书
  15. // *
  16. // * @author 81229
  17. // * @date 2020/4/24
  18. // * @since 1.0.0
  19. // */
  20. //@Component
  21. //public class LicenseCheckListener implements ApplicationListener<ContextRefreshedEvent> {
  22. // private static Logger logger = LoggerFactory.getLogger(LicenseCheckListener.class);
  23. //
  24. // /**
  25. // * 证书subject
  26. // */
  27. // @Value("${license.subject}")
  28. // private String subject;
  29. //
  30. // /**
  31. // * 公钥别称
  32. // */
  33. // @Value("${license.publicAlias}")
  34. // private String publicAlias;
  35. //
  36. // /**
  37. // * 访问公钥库的密码
  38. // */
  39. // @Value("${license.storePass}")
  40. // private String storePass;
  41. //
  42. // /**
  43. // * 证书生成路径
  44. // */
  45. // @Value("${license.licensePath}")
  46. // private String licensePath;
  47. // private static boolean installLic=false;
  48. // /**
  49. // * 密钥库存储路径
  50. // */
  51. // @Value("${license.publicKeysStorePath}")
  52. // private String publicKeysStorePath;
  53. //
  54. // @Override
  55. // public void onApplicationEvent(ContextRefreshedEvent event) {
  56. // //root application context 没有parent
  57. //// ApplicationContext context = event.getApplicationContext().getParent();
  58. //// if(context == null){
  59. // if(StringUtils.isNotBlank(licensePath) && !installLic){
  60. // logger.info("++++++++ 开始安装证书 ++++++++");
  61. // logger.info("++++++++ start install cert lic ++++++++");
  62. // LicenseVerifyParam param = new LicenseVerifyParam();
  63. // param.setSubject(subject);
  64. // param.setPublicAlias(publicAlias);
  65. // param.setStorePass(storePass);
  66. // param.setLicensePath(licensePath);
  67. // param.setPublicKeysStorePath(publicKeysStorePath);
  68. // LicenseVerify licenseVerify = new LicenseVerify();
  69. // //安装证书
  70. // try {
  71. // licenseVerify.install(param);
  72. // logger.info("++++++++ 证书安装结束 ++++++++");
  73. // logger.info("++++++++ end to install cert lic and success ++++++++");
  74. // installLic=true;
  75. // } catch (Exception e) {
  76. // logger.info(e.getMessage());
  77. // installLic=false;
  78. // logger.info("++++++++ end to install cert lic and failed ++++++++");
  79. // }
  80. // }
  81. //// }
  82. // }
  83. //}