2022.4.7

1.swagger配置

(1)先出现了异常:org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException。

我做了如下操作:

首先更改pom文件

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>20.0</version>
        </dependency>

更换了swagger的配置,从aliyun的换成了springfox的swagger,这个不行。

其次增加了一个注解:

@Configuration
@EnableSwagger2
@EnableWebMvc//这个是增加的
public class SwaggerConfig implements WebMvcConfigurer {

(2)这时不出现空指针了又出现了异常

No mapping for GET /swagger-ui.html

这个时候做了如下方法:

@Configuration//实现了这个接口
public class WebMvcConfigurer extends WebMvcConfigurationSupport {

    /**
     * 发现如果继承了WebMvcConfigurationSupport,则在yml中配置的相关内容会失效。 需要重新指定静态资源
     *
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations(
                "classpath:/static/");
        registry.addResourceHandler("swagger-ui.html").addResourceLocations(
                "classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations(
                "classpath:/META-INF/resources/webjars/");
        super.addResourceHandlers(registry);
    }
}

这样就ok了

素写星辰https://suxiexingchen.github.io/2019/11/12/28/相关参考

2.mybatis的转意字符

<![CDATA[ ]]>标记的sql语句中的<where> <if>等标签不会被解析 

这个是什么意思?

模糊查询,嵌套查询?

&lt;<小于
&gt;>大于
&amp;&
&apos;单引号
&quot;"双引号

 Mybatis 中的转义字符及常用查询_fengdong1996的博客-CSDN博客_mybatis转义字符

回家任務(7-10點):

1.數字字典的學習:2個

2.day4的程序完成 :2個        √

3.權限管理的學習:1個(待定)

4.流的方法:√

map:就是映射的意思,就是把我要流的东西按照map里的规则映射

sort:

倒过来就打负号;里面就是传两个参数。

报错:

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

   siteController (field private com.weareint.mcs_test.service.ISiteService com.weareint.mcs_test.controller.SiteController.iSiteService)
┌─────┐
|  siteServiceImpl (field private com.weareint.mcs_test.service.ITranshipPlatformService com.weareint.mcs_test.service.impl.SiteServiceImpl.iTranshipPlatformServicepl)
↑     ↓
|  transhipPlatformServiceImpl (field private com.weareint.mcs_test.service.ISiteService com.weareint.mcs_test.service.impl.TranshipPlatformServiceImpl.iSiteService)
└─────┘


Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

service层就调用mapper,解决问题。

//这么写就是循环依赖
        WmNews wmNews = wmNewsService.getById(id);
//更改之后
        WmNews wmNews = wmNewsMapper.selectById(id);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值