Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
8a941b2c
Commit
8a941b2c
authored
Nov 10, 2021
by
hweeeeeei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加dubbo服务发现
parent
fdb7b594
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
12 deletions
+58
-12
bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
+9
-0
common/pom.xml
+0
-6
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
+3
-3
config/src/main/resources/config/application-dev.yml
+7
-0
pom.xml
+39
-3
No files found.
bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
View file @
8a941b2c
...
...
@@ -17,12 +17,14 @@
package
io
.
geekidea
.
springbootplus
;
import
io.geekidea.springbootplus.framework.util.PrintApplicationInfo
;
import
org.apache.dubbo.config.spring.context.annotation.EnableDubbo
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
...
...
@@ -31,6 +33,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 项目启动入口
*/
@EnableDiscoveryClient
@EnableDubbo
(
scanBasePackages
=
{
"com.wecloud.im.service.impl"
})
@EnableAsync
@EnableScheduling
@EnableTransactionManagement
...
...
@@ -42,6 +46,11 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
public
class
SpringBootPlusApplication
{
public
static
void
main
(
String
[]
args
)
{
// 项目框架 集成logback 与nacos 自带的logback 冲突, nacos的logback 已经先于 项目启动,
// logback 本身 在命名之后不允许二次修改contextName的名字,问题在阿里nacos 官方git上已有人提出,
// https://github.com/alibaba/nacos/issues/1959
System
.
setProperty
(
"nacos.logging.default.config.enabled"
,
"false"
);
// 启动spring-boot-plus
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
SpringBootPlusApplication
.
class
,
args
);
// 打印项目信息
...
...
common/pom.xml
View file @
8a941b2c
...
...
@@ -22,12 +22,6 @@
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
<version>
2.2.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.google.firebase
</groupId>
<artifactId>
firebase-admin
</artifactId>
<version>
6.4.0
</version>
...
...
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
View file @
8a941b2c
...
...
@@ -46,9 +46,9 @@ public class WsReadHandler extends SimpleChannelInboundHandler<TextWebSocketFram
* io密集型任务配置尽可能多的线程数量
*/
private
final
static
ExecutorService
TASK_THREAD_POOL_EXECUTOR
=
new
ThreadPoolExecutor
(
WsConstants
.
CPU_PROCESSORS
*
5
,
WsConstants
.
CPU_PROCESSORS
*
10
,
1
0L
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
10
),
NAMED_THREAD_FACTORY
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
new
ThreadPoolExecutor
(
WsConstants
.
CPU_PROCESSORS
*
2
,
WsConstants
.
CPU_PROCESSORS
*
2
,
3
0L
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
10
24
*
5
),
NAMED_THREAD_FACTORY
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
@Override
protected
void
channelRead0
(
ChannelHandlerContext
ctx
,
TextWebSocketFrame
msg
)
{
...
...
config/src/main/resources/config/application-dev.yml
View file @
8a941b2c
...
...
@@ -37,6 +37,13 @@ spring:
server-addr
:
localhost:8848
dubbo
:
protocol
:
port
:
20881
name
:
dubbo
registry
:
address
:
nacos://localhost:8848?username=nacos&password=nacos
# 打印SQL语句和结果集,本地开发环境可开启,线上注释掉
mybatis-plus
:
configuration
:
...
...
pom.xml
View file @
8a941b2c
...
...
@@ -14,6 +14,7 @@
<properties>
<utf8>
UTF-8
</utf8>
<dubbo.version>
2.7.14
</dubbo.version>
<boot.artifact.name>
bootstrap-${project.version}
</boot.artifact.name>
<assembly.name>
spring-boot-plus-server-${project.version}
</assembly.name>
<admin.artifact.name>
admin-${project.version}
</admin.artifact.name>
...
...
@@ -326,13 +327,48 @@
</dependencyManagement>
<dependencies>
<!-- rabbitmq -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-amqp
</artifactId>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
${dubbo.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
${dubbo.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-registry-nacos
</artifactId>
<version>
${dubbo.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-config
</artifactId>
<version>
2.2.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
<version>
2.2.5.RELEASE
</version>
</dependency>
<!-- rabbitmq -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-amqp</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>
net.logstash.logback
</groupId>
<artifactId>
logstash-logback-encoder
</artifactId>
<version>
5.3
</version>
...
...
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