类org.springframework.boot.info.BuildProperties源码实例Demo

下面列出了怎么用org.springframework.boot.info.BuildProperties的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: radman   文件: MenuTemplate.java

public MenuTemplate(BuildProperties buildProperties) {
    getModel().setVersion(buildProperties.getVersion());

    addCategoryName("RadMan");
    addNavigation(UsersView.class, "Users");
    addNavigation(UserGroupsView.class, "User groups");
    addNavigation(AttributesView.class, "Attributes");
    addSeparator();
    addCategoryName("Radius");
    addNavigation(NasView.class, "NAS");
    addNavigation(NasGroupsView.class, "NAS groups");
    addNavigation(AuthView.class, "Auth (AA)");
    addNavigation(AccountingView.class, "Accounting");
    addNavigation(UserToGroupView.class, "User/Group");
    addSeparator();
    addCategoryName("System");
    addNavigation(SystemUsersView.class, "System users");
}
 

public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
     Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : "";
    this.jHipsterProperties = jHipsterProperties;
    if (this.jHipsterProperties.getLogging().isUseJsonFormat()) {
        addJsonConsoleAppender(context);
    }
    if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashTcpSocketAppender(context);
    }
    if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addContextListener(context);
    }
    if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context);
    }
}
 

public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
     Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : "";
    this.jHipsterProperties = jHipsterProperties;
    if (this.jHipsterProperties.getLogging().isUseJsonFormat()) {
        addJsonConsoleAppender(context);
    }
    if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashTcpSocketAppender(context);
    }
    if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addContextListener(context);
    }
    if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context);
    }
}
 

public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
     Optional<BuildProperties> buildProperties, JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.version = buildProperties.isPresent() ? buildProperties.get().getVersion() : "";
    this.jHipsterProperties = jHipsterProperties;
    if (this.jHipsterProperties.getLogging().isUseJsonFormat()) {
        addJsonConsoleAppender(context);
    }
    if (this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashTcpSocketAppender(context);
    }
    if (this.jHipsterProperties.getLogging().isUseJsonFormat() || this.jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addContextListener(context);
    }
    if (this.jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context);
    }
}
 
源代码5 项目: cerberus   文件: KmsService.java

@Autowired
public KmsService(
    AwsIamRoleDao awsIamRoleDao,
    UuidSupplier uuidSupplier,
    KmsClientFactory kmsClientFactory,
    KmsPolicyService kmsPolicyService,
    DateTimeSupplier dateTimeSupplier,
    AwsIamRoleArnParser awsIamRoleArnParser,
    @Value("${cerberus.auth.kms.policy.validation.interval.millis:300000}")
        int kmsKeyPolicyValidationInterval,
    @Value("${cerberus.environmentName}") String environmentName,
    Slugger slugger,
    BuildProperties buildProperties) {

  this.awsIamRoleDao = awsIamRoleDao;
  this.uuidSupplier = uuidSupplier;
  this.kmsClientFactory = kmsClientFactory;
  this.kmsPolicyService = kmsPolicyService;
  this.dateTimeSupplier = dateTimeSupplier;
  this.awsIamRoleArnParser = awsIamRoleArnParser;
  this.kmsKeyPolicyValidationInterval = kmsKeyPolicyValidationInterval;
  this.environmentName = environmentName;
  this.slugger = slugger;
  this.buildProperties = buildProperties;
}
 
源代码6 项目: jhipster   文件: PrefixedKeyGenerator.java

private String generatePrefix(GitProperties gitProperties, BuildProperties buildProperties) {

        String shortCommitId = null;
        if (Objects.nonNull(gitProperties)) {
            shortCommitId = gitProperties.getShortCommitId();
        }

        Instant time = null;
        String version = null;
        if (Objects.nonNull(buildProperties)) {
            time = buildProperties.getTime();
            version = buildProperties.getVersion();
        }
        Object p = ObjectUtils.firstNonNull(shortCommitId, time, version, RandomStringUtils.randomAlphanumeric(12));

        if (p instanceof Instant) {
            return DateTimeFormatter.ISO_INSTANT.format((Instant) p);
        }
        return p.toString();
    }
 
源代码7 项目: cerberus   文件: AuditLoggingFilter.java

@Autowired
public AuditLoggingFilter(
    SdbAccessRequest sdbAccessRequest,
    AuditLoggingFilterDetails auditLoggingFilterDetails,
    BuildProperties buildProperties,
    ApplicationEventPublisher applicationEventPublisher) {

  this.sdbAccessRequest = sdbAccessRequest;
  this.auditLoggingFilterDetails = auditLoggingFilterDetails;
  this.buildProperties = buildProperties;
  this.applicationEventPublisher = applicationEventPublisher;
}
 
源代码8 项目: cerberus   文件: KmsServiceTest.java

@Before
public void setup() {
  awsIamRoleDao = mock(AwsIamRoleDao.class);
  uuidSupplier = mock(UuidSupplier.class);
  kmsClientFactory = mock(KmsClientFactory.class);
  kmsPolicyService = mock(KmsPolicyService.class);
  dateTimeSupplier = mock(DateTimeSupplier.class);
  slugger = new Slugger();

  var props = new Properties();
  props.setProperty("artifact", ARTIFACT);
  props.setProperty("version", VERSION);
  var buildProps = new BuildProperties(props);

  kmsService =
      new KmsService(
          awsIamRoleDao,
          uuidSupplier,
          kmsClientFactory,
          kmsPolicyService,
          dateTimeSupplier,
          new AwsIamRoleArnParser(),
          3000,
          ENV,
          slugger,
          buildProps);
}
 

public LoggingConfiguration(@Value("${spring.application.name}") String appName,
                            @Value("${server.port}") String serverPort,
                            JHipsterProperties jHipsterProperties,
                            ObjectProvider<BuildProperties> buildProperties,
                            ObjectMapper mapper) throws JsonProcessingException {

    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();

    Map<String, String> map = new HashMap<>();
    map.put("app_name", appName);
    map.put("app_port", serverPort);
    buildProperties.ifAvailable(it -> map.put("version", it.getVersion()));
    String customFields = mapper.writeValueAsString(map);

    JHipsterProperties.Logging loggingProperties = jHipsterProperties.getLogging();
    JHipsterProperties.Logging.Logstash logstashProperties = loggingProperties.getLogstash();

    if (loggingProperties.isUseJsonFormat()) {
        addJsonConsoleAppender(context, customFields);
    }
    if (logstashProperties.isEnabled()) {
        addLogstashTcpSocketAppender(context, customFields, logstashProperties);
    }
    if (loggingProperties.isUseJsonFormat() || logstashProperties.isEnabled()) {
        addContextListener(context, customFields, loggingProperties);
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context, loggingProperties.isUseJsonFormat());
    }
}
 
源代码10 项目: fredbet   文件: SystemInfoService.java

@Autowired
public SystemInfoService(BuildProperties buildProperties, Environment environment, Optional<GitProperties> gitProperties) {
    this.buildProperties = buildProperties;
    this.environment = environment;
    this.gitProperties = gitProperties;
    addStaticProperties();
}
 
源代码11 项目: feast   文件: AuthTestConfig.java

@Bean
public BuildProperties buildProperties() {
  Properties props = new Properties();
  props.put("version", "test");
  return new BuildProperties(props);
}
 
源代码12 项目: egeria   文件: AboutController.java

@GetMapping
public BuildProperties getBuildProperties(HttpServletRequest request) throws HttpClientErrorException {
    return buildProperties;
}
 
源代码13 项目: jhipster   文件: PrefixedKeyGeneratorTest.java

@Test
public void generatePrefixFromBuildVersion() {

    Properties buildProperties = new Properties();
    buildProperties.put("version", "1.0.0");

    PrefixedKeyGenerator prefixedKeyGenerator = new PrefixedKeyGenerator(null, new BuildProperties(buildProperties));

    assertThat(prefixedKeyGenerator.getPrefix()).isEqualTo("1.0.0");
}
 
源代码14 项目: jhipster   文件: PrefixedKeyGeneratorTest.java

@Test
public void generatePrefixFromBuildTime() {

    Properties buildProperties = new Properties();
    buildProperties.put("time", "1583955265");

    PrefixedKeyGenerator prefixedKeyGenerator = new PrefixedKeyGenerator(null, new BuildProperties(buildProperties));

    assertThat(prefixedKeyGenerator.getPrefix()).isEqualTo("1970-01-19T07:59:15.265Z");
}
 
源代码15 项目: feast   文件: FeastProperties.java

/**
 * Instantiates a new Feast Serving properties.
 *
 * @param buildProperties the build properties
 */
@Autowired
public FeastProperties(BuildProperties buildProperties) {
  setVersion(buildProperties.getVersion());
}
 
源代码16 项目: feast   文件: FeastProperties.java

/**
 * Instantiates a new Feast properties.
 *
 * @param buildProperties Feast build properties
 */
@Autowired
public FeastProperties(BuildProperties buildProperties) {
  setVersion(buildProperties.getVersion());
}
 
源代码17 项目: holdmail   文件: BuildInfoMapper.java

public BuildInfo fromProperties(BuildProperties properties) {

        return new BuildInfo(properties.getVersion(), properties.getTime());
    }
 
源代码18 项目: jhipster   文件: PrefixedKeyGenerator.java

public PrefixedKeyGenerator(GitProperties gitProperties, BuildProperties buildProperties) {

        this.prefix = generatePrefix(gitProperties, buildProperties);
    }
 
 类所在包
 类方法
 同包方法