@@ -44,6 +44,9 @@ public class AdminApplication { | |||||
@Value("${fm.videoType}") | @Value("${fm.videoType}") | ||||
private String videoType; | private String videoType; | ||||
@Value("${tcp.server.port}") | |||||
private int tcpServerPort; | |||||
@Bean | @Bean | ||||
public boolean isFmException() { | public boolean isFmException() { | ||||
return fmException; | return fmException; | ||||
@@ -73,6 +76,11 @@ public class AdminApplication { | |||||
public String videoType() { | public String videoType() { | ||||
return videoType; | return videoType; | ||||
} | } | ||||
@Bean | |||||
public int tcpServerPort() { | |||||
return tcpServerPort; | |||||
} | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
SpringApplication.run(AdminApplication.class, args); | SpringApplication.run(AdminApplication.class, args); | ||||
@@ -160,6 +160,10 @@ video: | |||||
maxPoolSize: 20 | maxPoolSize: 20 | ||||
queueCapacity: 1000 | queueCapacity: 1000 | ||||
namePrefix: aliyun-video-upload | namePrefix: aliyun-video-upload | ||||
tcp: | |||||
server: | |||||
port: 9010 | |||||
jasypt: | jasypt: | ||||
@@ -147,6 +147,10 @@ video: | |||||
maxPoolSize: 20 | maxPoolSize: 20 | ||||
queueCapacity: 1000 | queueCapacity: 1000 | ||||
namePrefix: aliyun-video-upload | namePrefix: aliyun-video-upload | ||||
tcp: | |||||
server: | |||||
port: 9010 | |||||
fm: | fm: | ||||
exception: false | exception: false | ||||
@@ -42,6 +42,9 @@ public class CApplication { | |||||
@Value("${fm.videoType}") | @Value("${fm.videoType}") | ||||
private String videoType; | private String videoType; | ||||
@Value("${tcp.server.port}") | |||||
private int tcpServerPort; | |||||
@Bean | @Bean | ||||
public boolean isFmException() { | public boolean isFmException() { | ||||
@@ -72,6 +75,11 @@ public class CApplication { | |||||
public String videoType() { | public String videoType() { | ||||
return videoType; | return videoType; | ||||
} | } | ||||
@Bean | |||||
public int tcpServerPort() { | |||||
return tcpServerPort; | |||||
} | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
SpringApplication.run(CApplication.class, args); | SpringApplication.run(CApplication.class, args); | ||||
@@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
@@ -27,8 +26,8 @@ public class TcpServer { | |||||
private final Logger log = LoggerFactory.getLogger(this.getClass()); | private final Logger log = LoggerFactory.getLogger(this.getClass()); | ||||
@Value("${tcp.server.port}") // Configure port in application.properties | |||||
private int port; | |||||
@Autowired | |||||
private int tcpServerPort; | |||||
@Autowired | @Autowired | ||||
HKPeopleNumberFactory peopleNumberFactory; | HKPeopleNumberFactory peopleNumberFactory; | ||||
@@ -36,8 +35,8 @@ public class TcpServer { | |||||
@PostConstruct | @PostConstruct | ||||
public void start() { | public void start() { | ||||
new Thread(() -> { | new Thread(() -> { | ||||
try (ServerSocket serverSocket = new ServerSocket(port)) { | |||||
log.info("TCP Server started on port {}", port); | |||||
try (ServerSocket serverSocket = new ServerSocket(tcpServerPort)) { | |||||
log.info("TCP Server started on port {}", tcpServerPort); | |||||
while (true) { | while (true) { | ||||
Socket clientSocket = serverSocket.accept(); | Socket clientSocket = serverSocket.accept(); | ||||