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了
2.mybatis的转意字符
<![CDATA[ ]]>标记的sql语句中的<where> <if>等标签不会被解析
这个是什么意思?
模糊查询,嵌套查询?
<; | < | 小于 |
>; | > | 大于 |
&; | & | 与 |
&apos; | ’ | 单引号 |
"; | " | 双引号 |
回家任務(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);