• linux安装mongodb及springboot增删查实现


    MongoDB官网下载

    https://www.mongodb.com/try/download/community
    在这里插入图片描述
    想下什么版本自己指定既可,最后下载tgz包.

    linux安装配置

    1.在/usr/local下创建mongodb目录

    cd /usr/local  //进入local目录
    mkdir mongodb //创建mongodb目录
    mkdir data		// 创建data文件夹用于后续数据库信息保存
    touch log		// 创建log文件用于保存数据库日志,这里创建的是文件,不然启动时会报错,亲生经历.
    tar -zxvf 安装包名称  /usr/local/Mongodb //解压tgz文件
    
    • 1
    • 2
    • 3
    • 4
    • 5

    2.配置环境变量

    vi /etc/profile
    
    • 1
    #你的mongodb的位置
    export MONGODB_HOME=/usr/local/mongodb
    export PATH=$PATH:$MONGODB_HOME/bin
    
    • 1
    • 2
    • 3
    #使环境变量生效
    source /etc/profile
    
    • 1
    • 2

    3.配置mongodb配置文件

    cd /usr/local/Mongodb/bin    //进入mongodb的bin目录 
    vi mongod.conf      //创建mongod.conf
    
    • 1
    • 2

    编辑mongod.conf

    storage:
        dbPath: "/usr/local/mongodb/data" //配置存放数据的目录
    systemLog:
        destination: file
        path: "/usr/local/mongodb/log"  配置存放日志的目录
        logAppend: true
    net:
        port: 27017
        bindIp: 0.0.0.0  //这里可以指定ip 0.0.0.0默认所有链接 可设置127.0.0.1
    processManagement:
    	fork: true
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    按 esc 键退出编辑模式,输入 :wq 保存关闭文件

    在bin目录测试启动,输入命令

    ./mongod --config mongod.conf
    
    • 1

    这样代表启动成功.
    进入mongoDB数据库,命令

    ./mongo
    
    • 1

    这里踩坑注意如果修改了mongod.conf 中的port 那么这里的命令需要改成 ./mongo --port 端口号

    use admin   //进入admin数据库
    
    • 1
    db.createUser({ user: 'name', pwd: 'name', roles: [{ role: 'dbOwner', db: 'localhostTest' }] })
    
    • 1

    注:创建名为 localhostTest 的数据库添加数据库管理员,账号为 name,密码为 name, 角色权限为 dbOwner

    springBoot中连接mongodb

    Maven依赖

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    
    • 1
    • 2
    • 3
    • 4

    application.properties配置

    #mongodb链接  mongodb://mongodb用户名:mongodb密码@服务器ip:服务器端口/DB名称?authSource=admin
    spring.data.mongodb.uri=mongodb://xxxxx:xxxxxxxx@xx.xxx.xxx.xx:xxxxx/xxxxxxxxx?authSource=admin
    
    • 1
    • 2

    MongoDBMsgController

    import com.example.chinese_dance.vo.msg.HistoryMessageVo;
    import com.example.chinese_dance.vo.msg.MsMessageVo;
    import com.example.common.base.ApiReturnCodeEnum;
    import com.example.common.base.RestResponse;
    import com.example.common.exception.ATException;
    import com.example.common.util.PageUtil;
    import com.example.idempotent.AutoIdempotent;
    import com.github.pagehelper.PageInfo;
    import com.mongodb.client.result.DeleteResult;
    import io.swagger.annotations.Api;
    import io.swagger.annotations.ApiImplicitParam;
    import io.swagger.annotations.ApiImplicitParams;
    import io.swagger.annotations.ApiOperation;
    import org.apache.commons.lang3.StringUtils;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.annotation.Scope;
    import org.springframework.data.mongodb.core.MongoOperations;
    import org.springframework.data.mongodb.core.query.Criteria;
    import org.springframework.data.mongodb.core.query.Query;
    import org.springframework.util.ObjectUtils;
    import org.springframework.web.bind.annotation.*;
    
    import java.util.ArrayList;
    import java.util.Comparator;
    import java.util.List;
    import java.util.regex.Pattern;
    
    @Scope("prototype")
    @RestController
    @RequestMapping("/rest/v1.0/Message")
    @Api(tags = "消息服务 V1.0版本控制层")
    public class MongoDBMsgController {
        private final static Logger logger = LoggerFactory.getLogger(MongoDBMsgController.class);
    
        @Autowired
        private MongoOperations mongoTemplate;
    
        @ApiOperation(value = "删除消息", notes = "删除消息")
        @RequestMapping(value = "delMsgBuId", method = RequestMethod.GET)
        @ApiImplicitParams({
                @ApiImplicitParam(paramType = "query", name = "messageId", value = "消息ID", dataType = "string")
        })
        @AutoIdempotent
        public RestResponse messageQuery(
                @RequestParam String messageId
        ) {
            try {
                Query query = new Query();
                query.addCriteria(Criteria.where("id").is(messageId));
                DeleteResult remove = mongoTemplate.remove(query,MsMessageVo.class);
                if(remove.getDeletedCount()>0){
                    return RestResponse.success();
                }
            } catch (ATException e) {
                RestResponse failRestResponse = null;
                if (!ObjectUtils.isEmpty(e.getObject())) {
                    failRestResponse = RestResponse.failed(e.getErrorIndex());
                } else {
                    failRestResponse = RestResponse.failed(e.getMsg(), ApiReturnCodeEnum.selectFail);
                }
                logger.error(RestResponse.toString(failRestResponse));
                return failRestResponse;
            } catch (Exception e) {
                e.printStackTrace();
                RestResponse failRestResponse = RestResponse.failed(e.getMessage(), ApiReturnCodeEnum.selectFail);
                logger.error(RestResponse.toString(failRestResponse));
                return failRestResponse;
            }
            return RestResponse.failed("数据不存在~", ApiReturnCodeEnum.customTips);
        }
    
        @ApiOperation(value = "历史消息查询", notes = "历史消息查询(查询条件)")
        @RequestMapping(value = "messageHistoryQuery", method = RequestMethod.POST)
        public RestResponse<PageInfo<MsMessageVo>> messageHistoryQuery(
                @RequestBody HistoryMessageVo historyMessageVo
        ) {
            PageInfo pageInfo = null;
            if (historyMessageVo.getType() == null) {
                return RestResponse.failed("类型不能为空~");
            }
            List<MsMessageVo> messageVoList = new ArrayList<>();
            try {
                Query query = new Query();
                query.addCriteria(Criteria.where("type").is(historyMessageVo.getType()));
                if (historyMessageVo.getClassify() != null) {
                    query.addCriteria(Criteria.where("classify").is(historyMessageVo.getClassify()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getId())) {
                    query.addCriteria(Criteria.where("id").is(historyMessageVo.getId()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getSendUserId())) {
                    query.addCriteria(Criteria.where("sendUserId").is(historyMessageVo.getSendUserId()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getSendUserNick())) {
                    query.addCriteria(Criteria.where("nick").is(historyMessageVo.getSendUserNick()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getSendTime())) {
                    //模糊查询
                    Pattern pattern = Pattern.compile("^.*" + historyMessageVo.getSendTime() + ".*$", Pattern.CASE_INSENSITIVE);
                    query.addCriteria(Criteria.where("sendTime").regex(pattern));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getGteSendTime())) {
                    //时间大于等于
                    query.addCriteria(Criteria.where("sendTime").gte(historyMessageVo.getGteSendTime()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getLteSendTime())) {
                    //时间小于等于
                    query.addCriteria(Criteria.where("sendTime").lte(historyMessageVo.getLteSendTime()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getContent())) {
                    //模糊查询
                    Pattern pattern = Pattern.compile("^.*" + historyMessageVo.getContent() + ".*$", Pattern.CASE_INSENSITIVE);
                    query.addCriteria(Criteria.where("msBodyVo.content").regex(pattern));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getRecipientId())) {
                    query.addCriteria(Criteria.where("msBodyVo.recipientId").is(historyMessageVo.getRecipientId()));
                }
                if (StringUtils.isNotBlank(historyMessageVo.getRecipientNick())) {
                    query.addCriteria(Criteria.where("msBodyVo.recipientNick").is(historyMessageVo.getRecipientNick()));
                }
                if(StringUtils.isNotBlank(historyMessageVo.getOwnerId())){
                    query.addCriteria(Criteria.where("ownerId").is(historyMessageVo.getOwnerId()));
                }
                messageVoList = mongoTemplate.find(query, MsMessageVo.class);
                //根据发送时间降序
                messageVoList.sort(Comparator.comparing(MsMessageVo::getSendTime).reversed());
                pageInfo = PageUtil.startPage(messageVoList, historyMessageVo.getPageNo(), historyMessageVo.getPageSize(), messageVoList.size());
            } catch (ATException e) {
                RestResponse failRestResponse = null;
                if (!ObjectUtils.isEmpty(e.getObject())) {
                    failRestResponse = RestResponse.failed(e.getErrorIndex());
                } else {
                    failRestResponse = RestResponse.failed(e.getMsg(), ApiReturnCodeEnum.selectFail);
                }
                logger.error(RestResponse.toString(failRestResponse));
                return failRestResponse;
            } catch (Exception e) {
                e.printStackTrace();
                RestResponse failRestResponse = RestResponse.failed(e.getMessage(), ApiReturnCodeEnum.selectFail);
                logger.error(RestResponse.toString(failRestResponse));
                return failRestResponse;
            }
            return RestResponse.success(pageInfo);
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147

    Msg实体

    HistoryMessageVo:历史消息条件参数实体

    import io.swagger.annotations.ApiModel;
    import io.swagger.annotations.ApiModelProperty;
    
    @ApiModel(value = "HistoryMessageVo", description = "历史消息条件参数实体")
    public class HistoryMessageVo {
        @ApiModelProperty(value = "页码", dataType = "Integer")
        private Integer pageNo;
        @ApiModelProperty(value = "页数", dataType = "Integer")
        private Integer pageSize;
        @ApiModelProperty(value = "发送者id", dataType = "String")
        private String sendUserId;
        @ApiModelProperty(value = "发送者昵称", dataType = "String")
        private String sendUserNick;
        @ApiModelProperty(value = "发出时间", dataType = "String")
        private String sendTime;
        @ApiModelProperty(value = "大于等于时间的数据", dataType = "String")
        private String gteSendTime;
        @ApiModelProperty(value = "小于等于时间的数据", dataType = "String")
        private String lteSendTime;
        @ApiModelProperty(value = "消息内容", dataType = "String")
        private String content;
        @ApiModelProperty(value = "接收者id", dataType = "String")
        private String recipientId;
        @ApiModelProperty(value = "接收者昵称", dataType = "String")
        private String recipientNick;
        @ApiModelProperty(value = "类型(1:群聊)",required = true, dataType = "Integer")
        private Integer type;
        @ApiModelProperty(value = "分类(0:聊天消息;1:系统消息)", dataType = "Integer")
        private Integer classify;
        @ApiModelProperty(value = "所有者id(直播间id)", dataType = "String")
        private String ownerId;
        @ApiModelProperty(value = "消息id", dataType = "String")
        private String id;
    
        public String getId() {
            return id;
        }
    
        public void setId(String id) {
            this.id = id;
        }
    
        public String getOwnerId() {
            return ownerId;
        }
    
        public void setOwnerId(String ownerId) {
            this.ownerId = ownerId;
        }
    
        public Integer getPageNo() {
            return pageNo;
        }
    
        public void setPageNo(Integer pageNo) {
            this.pageNo = pageNo;
        }
    
        public Integer getPageSize() {
            return pageSize;
        }
    
        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }
    
        public String getSendUserId() {
            return sendUserId;
        }
    
        public void setSendUserId(String sendUserId) {
            this.sendUserId = sendUserId;
        }
    
        public String getSendUserNick() {
            return sendUserNick;
        }
    
        public void setSendUserNick(String sendUserNick) {
            this.sendUserNick = sendUserNick;
        }
    
        public String getSendTime() {
            return sendTime;
        }
    
        public void setSendTime(String sendTime) {
            this.sendTime = sendTime;
        }
    
        public String getGteSendTime() {
            return gteSendTime;
        }
    
        public void setGteSendTime(String gteSendTime) {
            this.gteSendTime = gteSendTime;
        }
    
        public String getLteSendTime() {
            return lteSendTime;
        }
    
        public void setLteSendTime(String lteSendTime) {
            this.lteSendTime = lteSendTime;
        }
    
        public String getContent() {
            return content;
        }
    
        public void setContent(String content) {
            this.content = content;
        }
    
        public String getRecipientId() {
            return recipientId;
        }
    
        public void setRecipientId(String recipientId) {
            this.recipientId = recipientId;
        }
    
        public String getRecipientNick() {
            return recipientNick;
        }
    
        public void setRecipientNick(String recipientNick) {
            this.recipientNick = recipientNick;
        }
    
        public Integer getType() {
            return type;
        }
    
        public void setType(Integer type) {
            this.type = type;
        }
    
        public Integer getClassify() {
            return classify;
        }
    
        public void setClassify(Integer classify) {
            this.classify = classify;
        }
    
        @Override
        public String toString() {
            return "HistoryMessageVo{" +
                    "pageNo=" + pageNo +
                    ", pageSize=" + pageSize +
                    ", sendUserId='" + sendUserId + '\'' +
                    ", sendUserNick='" + sendUserNick + '\'' +
                    ", sendTime='" + sendTime + '\'' +
                    ", gteSendTime='" + gteSendTime + '\'' +
                    ", lteSendTime='" + lteSendTime + '\'' +
                    ", content='" + content + '\'' +
                    ", recipientId='" + recipientId + '\'' +
                    ", recipientNick='" + recipientNick + '\'' +
                    ", type=" + type +
                    ", classify=" + classify +
                    '}';
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164

    MsBodyVo:消息体

    import io.swagger.annotations.ApiModel;
    import io.swagger.annotations.ApiModelProperty;
    
    import java.io.Serializable;
    
    @ApiModel(value = "MsBodyVo", description = "消息体")
    public class MsBodyVo implements Serializable {
    
        private static final long serialVersionUID = 1L;
    
        @ApiModelProperty(value = "消息体", dataType = "String", required = true, example = "0")
        private String content;
        @ApiModelProperty(value = "接收者id", dataType = "String", example = "0")
        private String recipientId;
        @ApiModelProperty(value = "接收者昵称*", dataType = "String", example = "0")
        private String recipientNick;
        @ApiModelProperty(value = "图片/视频Url", dataType = "String")
        private String url;
    
        public String getRecipientNick() {
            return recipientNick;
        }
    
        public void setRecipientNick(String recipientNick) {
            this.recipientNick = recipientNick;
        }
    
        public String getContent() {
            return content;
        }
    
        public void setContent(String content) {
            this.content = content;
        }
    
        public String getRecipientId() {
            return recipientId;
        }
    
        public void setRecipientId(String recipientId) {
            this.recipientId = recipientId;
        }
    
        public String getUrl() {
            return url;
        }
    
        public void setUrl(String url) {
            this.url = url;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51

    MsMessageVo:消息

    import io.swagger.annotations.ApiModel;
    import io.swagger.annotations.ApiModelProperty;
    
    import java.io.Serializable;
    
    @ApiModel(value = "MsMessageVo", description = "消息")
    public class MsMessageVo implements Serializable {
        private static final long serialVersionUID = 1L;
    
        @ApiModelProperty(value = "id ", dataType = "String")
        private String id;
    
        /**
         * 发送者id
         */
        @ApiModelProperty(value = "发送者id", required = true, dataType = "String", example = "0")
        private String sendUserId;
    
        /**
         * 头像*
         */
        @ApiModelProperty(value = "头像*", required = true, dataType = "String", example = "0")
        private String head_image;
        /**
         * 名称*
         */
        @ApiModelProperty(value = "昵称*", required = true, dataType = "String", example = "0")
        private String nick;
        /**
         * 类型(0:发出;1:回复)
         */
        @ApiModelProperty(value = "类型(0:群聊)", dataType = "Integer", example = "0")
        private Integer type;
    
        @ApiModelProperty(value = "分类(0:聊天消息;1:系统消息)", required = true, dataType = "Integer", example = "0")
        private Integer classify;
    
        @ApiModelProperty(value = "消息体",required = true)
        private MsBodyVo msBodyVo;
        /**
         * 发出时间
         */
        @ApiModelProperty(value = "发出时间", dataType = "String", example = "2021-02-02 17:09:32")
        private String sendTime;
        /**
         * 所有者id
         */
        @ApiModelProperty(value = "所有者id(直播间id)", required = true, dataType = "String", example = "0")
        private String ownerId;
    
        public Integer getClassify() {
            return classify;
        }
    
        public void setClassify(Integer classify) {
            this.classify = classify;
        }
    
        public String getId() {
            return id;
        }
    
        public void setId(String id) {
            this.id = id;
        }
    
    
        public String getSendUserId() {
            return sendUserId;
        }
    
        public void setSendUserId(String sendUserId) {
            this.sendUserId = sendUserId;
        }
    
        public Integer getType() {
            return type;
        }
    
        public void setType(Integer type) {
            this.type = type;
        }
    
        public MsBodyVo getMsBodyVo() {
            return msBodyVo;
        }
    
        public void setMsBodyVo(MsBodyVo msBodyVo) {
            this.msBodyVo = msBodyVo;
        }
    
        public String getSendTime() {
            return sendTime;
        }
    
        public void setSendTime(String sendTime) {
            this.sendTime = sendTime;
        }
    
        public String getOwnerId() {
            return ownerId;
        }
    
        public void setOwnerId(String ownerId) {
            this.ownerId = ownerId;
        }
    
        public String getHead_image() {
            return head_image;
        }
    
        public void setHead_image(String head_image) {
            this.head_image = head_image;
        }
    
        public String getNick() {
            return nick;
        }
    
        public void setNick(String nick) {
            this.nick = nick;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123

    报错:The connection string contains invalid user information. If the username or password contains a colo…

    错误 原因连接mongoDB 的url 中 用户名 或密码出现了 @ 或 : 符号
    url 中原本就带有 @ 和 : 用户名 或密码 再出现 这两个字符时就无法区分哪个是真正的分隔符

    解决办法:
    对@使用16进制进行URL编码:%40
    对:使用16进制进行URL编码:%3A
    用上面16进制的URL编码代替原本的字符就行了。

  • 相关阅读:
    模拟实现qsort函数(冒泡排序版本)
    CentOS 7 编译 arm版本 opssl
    导数大题练习
    【重识云原生】第六章容器基础6.4.9.4节——Service拓扑感知提示
    华清远见上海中心22071班
    一看就会的FTP文件服务器操作,Java,全!
    linux的常用命令
    经济专业技术资格考试-经济专业技术资格分为初级、中级、高级三个级别
    教程 | Datavines 自定义数据质量检查规则(Metric)
    神奇代码备份恢复工具逸事与操作指南
  • 原文地址:https://blog.csdn.net/pengxiaozhong/article/details/126040240