mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-18 21:30:10 +01:00
fix: version showing as 0.0.0
This commit is contained in:
parent
362a7ff434
commit
edde1a6436
@ -1,8 +1,13 @@
|
|||||||
package stirling.software.SPDF.config;
|
package stirling.software.SPDF.config;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
import stirling.software.SPDF.model.ApplicationProperties;
|
import stirling.software.SPDF.model.ApplicationProperties;
|
||||||
|
|
||||||
@ -24,8 +29,15 @@ public class AppConfig {
|
|||||||
|
|
||||||
@Bean(name = "appVersion")
|
@Bean(name = "appVersion")
|
||||||
public String appVersion() {
|
public String appVersion() {
|
||||||
String version = getClass().getPackage().getImplementationVersion();
|
Resource resource = new ClassPathResource("version.properties");
|
||||||
return (version != null) ? version : "0.0.0";
|
Properties props = new Properties();
|
||||||
|
try {
|
||||||
|
props.load(resource.getInputStream());
|
||||||
|
return props.getProperty("version");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "0.0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "homeText")
|
@Bean(name = "homeText")
|
||||||
|
Loading…
Reference in New Issue
Block a user