diff --git a/powerjob-worker-samples/src/main/java/com/github/kfcfans/powerjob/samples/OhMySchedulerConfig.java b/powerjob-worker-samples/src/main/java/com/github/kfcfans/powerjob/samples/OhMySchedulerConfig.java index 10bc9c26..7c7b410b 100644 --- a/powerjob-worker-samples/src/main/java/com/github/kfcfans/powerjob/samples/OhMySchedulerConfig.java +++ b/powerjob-worker-samples/src/main/java/com/github/kfcfans/powerjob/samples/OhMySchedulerConfig.java @@ -4,6 +4,7 @@ import com.github.kfcfans.powerjob.worker.OhMyWorker; import com.github.kfcfans.powerjob.worker.common.OhMyConfig; import com.github.kfcfans.powerjob.worker.common.constants.StoreStrategy; import com.google.common.collect.Lists; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -17,6 +18,10 @@ import java.util.List; */ @Configuration public class OhMySchedulerConfig { + + @Value("${powerjob.akka.port}") + private int port; + @Bean public OhMyWorker initOMS() throws Exception { @@ -25,7 +30,7 @@ public class OhMySchedulerConfig { // 1. 创建配置文件 OhMyConfig config = new OhMyConfig(); - config.setPort(27777); + config.setPort(port); config.setAppName("oms-test"); config.setServerAddress(serverAddress); // 如果没有大型 Map/MapReduce 的需求,建议使用内存来加速计算 diff --git a/powerjob-worker-samples/src/main/resources/application.properties b/powerjob-worker-samples/src/main/resources/application.properties index 8e87e783..7d804f17 100644 --- a/powerjob-worker-samples/src/main/resources/application.properties +++ b/powerjob-worker-samples/src/main/resources/application.properties @@ -1,3 +1,5 @@ server.port=8081 -spring.jpa.open-in-view=false \ No newline at end of file +spring.jpa.open-in-view=false + +powerjob.akka.port=27777 \ No newline at end of file