springboot整合netty

本文介绍了如何在SpringBoot项目中移除默认的Tomcat容器,并整合Netty。在整合过程中,由于Netty的ChannelHandler线程安全问题与SpringBoot的单例模式存在冲突,文章列举了错误代码及相应原因,并提供了相关参考资料进行详细解释。
摘要由CSDN通过智能技术生成

1.pom.xml

通常的springboot 的pom文件有springboot-starter-web依赖,这样会为项目添加tomcat容器,端口8080,由于这个项目用netty,不需要tomcat,所以用

spring-boot-starter和spring-boot-configuration-processor
 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 3     <modelVersion>4.0.0</modelVersion>
 4     <groupId>demo.netty</groupId>
 5     <artifactId>nettyspringboot</artifactId>
 6     <version>0.0.1-SNAPSHOT</version>
 7 
 8     <parent>
 9         <groupId>org.springframework.boot</groupId>
10         <artifactId>spring-boot-starter-parent</artifactId>
11         <version>2.1.6.RELEASE</version>
12         
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值