spring boot 整合swagger

原文链接:https://www.cnblogs.com/cndarren/p/11769342.html

demo实现的过程中也经历了很多的bug。bug开路!!!!

BUG1 :

在这里插入图片描述
这个是注解错误,复制的依赖都有错误。。。
在网上搜索得到的反馈是下载依赖缺失。
解决思路:
在这里插入图片描述
在这里插入图片描述

ok,解决

然后 第二个bug

在这里插入图片描述

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/tool/idea/ij/IntelliJ%20IDEA%202017.2.2/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/apache-maven-3.6.1-bin/apache-maven-3.6.1/conf/responsitory/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

大体的意思就是,有两个slf4j这个依赖,有冲突了。
在这里插入图片描述
解决方式,依赖有问题,需要排除这个logging

原文链接:https://blog.csdn.net/a704397849/article/details/98487404

第三个bug:

在这里插入图片描述

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.apache.logging.slf4j.Log4jLoggerFactory loaded from jar:file:/home/CubeStorageSystem-0.1-SNAPSHOT.jar!/BOOT-INF/lib/log4j-slf4j-impl-2.7.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.apache.logging.slf4j.Log4jLoggerFactory
    at org.springframework.util.Assert.instanceCheckFailed(Assert.java:389)
    at org.springframework.util.Assert.isInstanceOf(Assert.java:327)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)
    at org.springframework.boot.logging.logback.Logb

问题原因,还是依赖的原因,因为依赖版本的原因导致出现错误


<dependency>
   <groupId>org.apache.logging.log
4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>2.9.1</version>
</dependency>

原文链接:https://blog.csdn.net/Lovincc/article/details/78438291

到这里, 程序就算是跑起来了

展示结果:

在这里插入图片描述
在这里插入图片描述
1、 商品列表
http://localhost:8080/goods/to_list

response

success
[
	{
		"goods.goodsName":"iphone11",
		"goods.goodsImg":"pic/iphone.png",
		"goods.goodsPrice":"10000.0",
		"goods.goodsmiaoshaPrice":"1.0",
		"goods.stockCount":10,
		"goods.id":3
	}
	{
		"goods.goodsName":"p40",
		"goods.goodsImg":"pic/p40.png",
		"goods.goodsPrice":"6900.0",
		"goods.goodsmiaoshaPrice":"1.0",
		"goods.stockCount":10,
		"goods.id":4
	}
]

2、 商品详情页面
http://localhost:8080/goods/to_detail/3

response

success
[
	{
		"goods.goodsName":"iphone11",
		"goods.goodsImg":"pic/iphone.png",
		"goods.goodsPrice":"10000.0",
		"goods.startDate":"2020-06-01 16:50:00",
		"goods.miaoshaPrice":"1.0",
		"goods.stockCount":10,
		"goods.id":3
	}
	
]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值