BAEL-3499 Moved code to spring-boot-properties (#8643)
This commit is contained in:
committed by
GitHub
parent
3b4c813b43
commit
6dcb329bbc
+18
@@ -0,0 +1,18 @@
|
||||
package com.baeldung.buildproperties;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = "com.baeldung.buildproperties")
|
||||
@PropertySource("classpath:build.properties")
|
||||
//@PropertySource("classpath:build.yml")
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.baeldung.buildproperties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class BuildInfoService {
|
||||
@Value("${application-description}")
|
||||
private String applicationDescription;
|
||||
|
||||
@Value("${application-version}")
|
||||
private String applicationVersion;
|
||||
|
||||
public String getApplicationDescription() {
|
||||
return applicationDescription;
|
||||
}
|
||||
|
||||
public String getApplicationVersion() {
|
||||
return applicationVersion;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user