BizSupportConfiguration.java 895 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * DBSyncer Copyright 2020-2024 All Rights Reserved.
  3. */
  4. package org.dbsyncer.biz;
  5. import org.dbsyncer.biz.impl.DefaultLicenseServiceImpl;
  6. import org.dbsyncer.sdk.spi.LicenseService;
  7. import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
  8. import org.springframework.context.annotation.Bean;
  9. import org.springframework.context.annotation.Configuration;
  10. import java.util.ServiceLoader;
  11. /**
  12. * @Author AE86
  13. * @Version 1.0.0
  14. * @Date 2024-05-14 01:30
  15. */
  16. @Configuration
  17. public class BizSupportConfiguration {
  18. @Bean
  19. @ConditionalOnMissingBean
  20. public LicenseService licenseService() {
  21. ServiceLoader<LicenseService> services = ServiceLoader.load(LicenseService.class, Thread.currentThread().getContextClassLoader());
  22. for (LicenseService s : services) {
  23. return s;
  24. }
  25. return new DefaultLicenseServiceImpl();
  26. }
  27. }