Java Code Examples for org.springframework.boot.info.BuildProperties

The following examples show how to use org.springframework.boot.info.BuildProperties. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: radman   Source File: MenuTemplate.java    License: MIT License 6 votes vote down vote up
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");
}
 
Example 2
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);
    }
}
 
Example 3
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);
    }
}
 
Example 4
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);
    }
}
 
Example 5
Source Project: cerberus   Source File: KmsService.java    License: Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 6
Source Project: jhipster   Source File: PrefixedKeyGenerator.java    License: Apache License 2.0 6 votes vote down vote up
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();
    }
 
Example 7
Source Project: cerberus   Source File: AuditLoggingFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Autowired
public AuditLoggingFilter(
    SdbAccessRequest sdbAccessRequest,
    AuditLoggingFilterDetails auditLoggingFilterDetails,
    BuildProperties buildProperties,
    ApplicationEventPublisher applicationEventPublisher) {

  this.sdbAccessRequest = sdbAccessRequest;
  this.auditLoggingFilterDetails = auditLoggingFilterDetails;
  this.buildProperties = buildProperties;
  this.applicationEventPublisher = applicationEventPublisher;
}
 
Example 8
Source Project: cerberus   Source File: KmsServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 9
Source Project: jhipster-registry   Source File: LoggingConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example 10
@Autowired
public SystemInfoService(BuildProperties buildProperties, Environment environment, Optional<GitProperties> gitProperties) {
    this.buildProperties = buildProperties;
    this.environment = environment;
    this.gitProperties = gitProperties;
    addStaticProperties();
}
 
Example 11
Source Project: feast   Source File: AuthTestConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public BuildProperties buildProperties() {
  Properties props = new Properties();
  props.put("version", "test");
  return new BuildProperties(props);
}
 
Example 12
Source Project: egeria   Source File: AboutController.java    License: Apache License 2.0 4 votes vote down vote up
@GetMapping
public BuildProperties getBuildProperties(HttpServletRequest request) throws HttpClientErrorException {
    return buildProperties;
}
 
Example 13
Source Project: jhipster   Source File: PrefixedKeyGeneratorTest.java    License: Apache License 2.0 3 votes vote down vote up
@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");
}
 
Example 14
Source Project: jhipster   Source File: PrefixedKeyGeneratorTest.java    License: Apache License 2.0 3 votes vote down vote up
@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");
}
 
Example 15
Source Project: feast   Source File: FeastProperties.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Instantiates a new Feast Serving properties.
 *
 * @param buildProperties the build properties
 */
@Autowired
public FeastProperties(BuildProperties buildProperties) {
  setVersion(buildProperties.getVersion());
}
 
Example 16
Source Project: feast   Source File: FeastProperties.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Instantiates a new Feast properties.
 *
 * @param buildProperties Feast build properties
 */
@Autowired
public FeastProperties(BuildProperties buildProperties) {
  setVersion(buildProperties.getVersion());
}
 
Example 17
Source Project: holdmail   Source File: BuildInfoMapper.java    License: Apache License 2.0 2 votes vote down vote up
public BuildInfo fromProperties(BuildProperties properties) {

        return new BuildInfo(properties.getVersion(), properties.getTime());
    }
 
Example 18
Source Project: jhipster   Source File: PrefixedKeyGenerator.java    License: Apache License 2.0 2 votes vote down vote up
public PrefixedKeyGenerator(GitProperties gitProperties, BuildProperties buildProperties) {

        this.prefix = generatePrefix(gitProperties, buildProperties);
    }