001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.info; 018 019import java.nio.charset.Charset; 020import java.nio.charset.StandardCharsets; 021 022import org.springframework.boot.context.properties.ConfigurationProperties; 023import org.springframework.core.io.ClassPathResource; 024import org.springframework.core.io.Resource; 025 026/** 027 * Configuration properties for project information. 028 * 029 * @author Stephane Nicoll 030 * @since 1.4.0 031 */ 032@ConfigurationProperties(prefix = "spring.info") 033public class ProjectInfoProperties { 034 035 private final Build build = new Build(); 036 037 private final Git git = new Git(); 038 039 public Build getBuild() { 040 return this.build; 041 } 042 043 public Git getGit() { 044 return this.git; 045 } 046 047 /** 048 * Build specific info properties. 049 */ 050 public static class Build { 051 052 /** 053 * Location of the generated build-info.properties file. 054 */ 055 private Resource location = new ClassPathResource( 056 "META-INF/build-info.properties"); 057 058 /** 059 * File encoding. 060 */ 061 private Charset encoding = StandardCharsets.UTF_8; 062 063 public Resource getLocation() { 064 return this.location; 065 } 066 067 public void setLocation(Resource location) { 068 this.location = location; 069 } 070 071 public Charset getEncoding() { 072 return this.encoding; 073 } 074 075 public void setEncoding(Charset encoding) { 076 this.encoding = encoding; 077 } 078 079 } 080 081 /** 082 * Git specific info properties. 083 */ 084 public static class Git { 085 086 /** 087 * Location of the generated git.properties file. 088 */ 089 private Resource location = new ClassPathResource("git.properties"); 090 091 /** 092 * File encoding. 093 */ 094 private Charset encoding = StandardCharsets.UTF_8; 095 096 public Resource getLocation() { 097 return this.location; 098 } 099 100 public void setLocation(Resource location) { 101 this.location = location; 102 } 103 104 public Charset getEncoding() { 105 return this.encoding; 106 } 107 108 public void setEncoding(Charset encoding) { 109 this.encoding = encoding; 110 } 111 112 } 113 114}