谷粒商城-踩坑记录

原贴:https://blog.csdn.net/hancoder/article/details/106922139
视频:https://www.bilibili.com/video/BV1np4y1C7Yf?p=1

2021年3月23日 22:36:22

1.安装docker的时候,步骤用如下:

#1.卸载旧版本
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

#2.需要的安装包
yum install -y yum-utils

#3.设置镜像的仓库
#默认是从国外的,不推荐
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
#推荐使用国内的:阿里云
yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

#更新yum软件包索引
yum makecache fast

#4.安装docker相关的 docker-ce 社区版 而ee是企业版
yum install docker-ce docker-ce-cli containerd.io # 这里我们使用社区版即可

#5.启动docker
systemctl start docker

#这里如果启动不成功,可能是虚拟机防火墙没关
#查看防火墙状态
firewall-cmd --state
#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service 


#6. 使用docker version查看是否按照成功
docker version

2021年3月26日 00:16:08

然后去VScode的项目终端中输入 npm install,是要去拉取依赖(package.json类似于pom.xml的dependency),但是会报错,然后进行如下操作:

这里如果会报错

#删除
npm uninstall node-sass
#先下载
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
#再
npm install

2021年3月27日 16:02:30

然后在主启动类上加上注解@MapperScan()

这里附近实体类里有个问题

java错误找不到 Longblob类:改成byte[]  因为数据库和java接收的不同.

2021年3月28日 11:10:13

nacos作为我们的注册中心和配置中心。
注册中心文档:https://github.com/alibaba/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example
其他文档在该项目上层即可找到,下面读一读官网给的介绍就会用了。

这里nacos如果有报错,看这个
https://blog.csdn.net/qq_36537546/article/details/110039657

mysql新建库:nacos,字符集:utf8 ,排序规则:utf8_general_ci

p22

No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc出现这个问题是没有loadbalanc 但是nacos中ribbon会造成loadbalanc包失效

在common的pom加入
  <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-loadbalancer</artifactId>
            <version>2.2.2.RELEASE</version>
        </dependency>

P23

bootstrap.properties 不生效

#加入这一段:
<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
            <version>3.0.1</version>
        </dependency>

P45

递归,stream 值得多看看

P47

跨域还是报错

boot2.4以上的把addAllowedOrigin("*");改成addAllowedOriginPattern("*");

P51

httpget httppost 模板

"http-get请求":{
        "prefix":"httpget",
        "body":[
            "this.\\$http({",
            "url:this.\\$http.adornUrl(''),",
            "method:'get',",
            "params:this.\\$http.adornParams({})",
            "}).then(({data})=>{",
            "})"
        ],
        "description":"httpGET请求"
    },

    "http-post请求":{
        "prefix":"httppost",
        "body":[
            "this.\\$http({",
            "url:this.\\$http.adornUrl(''),",
            "method:'post',",
            "data: this.\\$http.adornData(data, false)",
            "}).then(({data})=>{ })"
        ],
        "description":"httpPOST请求"
    }

P62

阿里云oss sdk帮助文档
https://help.aliyun.com/document_detail/32009.html?spm=a2c4g.11186623.6.768.549d59aaWuZMGJ

不要用alibaba cloud的

#引入maven
<dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>3.10.2</version>
        </dependency>


// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "yourEndpoint";
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
String accessKeyId = "yourAccessKeyId";
String accessKeySecret = "yourAccessKeySecret";

// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);

// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
InputStream inputStream = new FileInputStream("D:\\localpath\\examplefile.txt");
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
ossClient.putObject("examplebucket", "exampleobject.txt", inputStream);

// 关闭OSSClient。
ossClient.shutdown();

P63

网关

- id: third_party_route
  uri: lb://gulimall-third-party
  predicates:
     - Path=/api/thirdparty/**
   filters: 
     - RewritePath=/api/thirdparty/(?<segment>/?.*),/$\{segment}
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值