Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
5b1ccbe3
Commit
5b1ccbe3
authored
Oct 10, 2023
by
xinglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)修改socket启动
parent
dac9e50d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
SocketConfig.java
...c/main/java/com/yeejoin/amos/kgd/config/SocketConfig.java
+18
-4
application.properties
...boot-system-kgd/src/main/resources/application.properties
+4
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/src/main/java/com/yeejoin/amos/kgd/config/SocketConfig.java
View file @
5b1ccbe3
package
com
.
yeejoin
.
amos
.
kgd
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.io.IOException
;
...
...
@@ -12,14 +15,25 @@ import java.net.Socket;
* @Description:
* @Date: 2023/10/9 18:45
*/
@Co
nfiguration
@Co
mponent
public
class
SocketConfig
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SocketConfig
.
class
);
@Value
(
"${socket.port}"
)
private
Integer
port
;
@PostConstruct
public
void
init
()
{
public
void
socketStart
()
{
//直接另起一个线程挂起Socket服务
new
Thread
(
this
::
socketServer
).
start
();
}
private
void
socketServer
()
{
ServerSocket
ss
=
null
;
try
{
ss
=
new
ServerSocket
(
7777
);
ss
=
new
ServerSocket
(
port
);
log
.
info
(
"socket端口在:{}中开启并持续监听=====>"
,
port
);
while
(
true
)
{
Socket
socket
=
ss
.
accept
();
// 创建新线程处理连接
...
...
amos-boot-system-kgd/src/main/resources/application.properties
View file @
5b1ccbe3
...
...
@@ -53,4 +53,6 @@ spring.servlet.multipart.maxRequestSize=100MB
spring.main.allow-bean-definition-overriding
=
true
spring.http.encoding.charset
=
utf-8
spring.http.encoding.enabled
=
true
spring.http.encoding.force
=
true
\ No newline at end of file
spring.http.encoding.force
=
true
socket.port
=
7777
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment