aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/ApiServer.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-03-28 23:52:19 +0300
committerGravatar Vitaly Takmazov2017-03-28 23:52:19 +0300
commit3382ed01dde0adebb4ef834a0dfd0baac392c040 (patch)
tree56b78b3aeea4b9bf42736382c43f6c5bc7217b7b /juick-api/src/main/java/com/juick/api/ApiServer.java
parent4a486b237c1f5cf27ac892abef2908d7ec9cdba6 (diff)
juick-api: inject properties with @Value
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/ApiServer.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/ApiServer.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java
index 4d260df8..7f4042af 100644
--- a/juick-api/src/main/java/com/juick/api/ApiServer.java
+++ b/juick-api/src/main/java/com/juick/api/ApiServer.java
@@ -21,6 +21,7 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.Extension;
@@ -37,24 +38,21 @@ public class ApiServer implements AutoCloseable {
private ExternalComponent xmpp;
+ @Value("${upload_tmp_dir:'/var/www/juick.com/i/tmp/'}")
public String tmpDir;
+ @Value("${img_path:'/var/www/juick.com/i/'}")
public String imgDir;
-
- private String xmppHost, xmppPassword, xmppJid;
+ @Value("${xmpp_host:'localhost'}")
+ private String xmppHost;
+ @Value("${xmpp_password:'secret'}")
+ private String xmppPassword;
+ @Value("${xmpp_jid:'api.localhost'}")
+ private String xmppJid;
+ @Value("${xmpp_port:5347}")
private int xmppPort;
+ @Value("${xmpp_disabled:false}")
private boolean isXmppDisabled;
-
- public ApiServer(Environment conf) {
- tmpDir = conf.getProperty("upload_tmp_dir", "/var/www/juick.com/i/tmp/");
- imgDir = conf.getProperty("img_path", "/var/www/juick.com/i/");
- isXmppDisabled = BooleanUtils.toBoolean(conf.getProperty("xmpp_disabled"));
- xmppHost = conf.getProperty("xmpp_host", "localhost");
- xmppPort = NumberUtils.toInt(conf.getProperty("xmpp_port", "5347"), 5347);
- xmppJid = conf.getProperty("xmpp_jid", "api.localhost");
- xmppPassword = conf.getProperty("xmpp_password");
- }
-
@PostConstruct
public void init() {
if (!isXmppDisabled) {