美文网首页
Error Records

Error Records

作者: JeffreyTaiT | 来源:发表于2020-02-13 17:43 被阅读0次

1.

Description:

Failed to configure a DataSource: no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

A:

检查application.properties中的数据库相关配置是否有误,pom.xml文件中是否有依赖冲突

如果都是OK的,那就去pom.xml中添加如下配置,参考出处

<resources>

<resource>

<directory>src/main/java</directory>

<includes>

<include>**/*.properties</include>

<include>**/*.xml</include>

<include>**/*.yml</include>

</includes>

<filtering>false</filtering>

</resource>

<resource>

<directory>src/main/resources</directory>

<includes>

<include>**/*.properties</include>

<include>**/*.xml</include>

<include>**/*.yml</include>

</includes>

<filtering>false</filtering>

</resource>

</resources>

2.Field xx in xx required a bean of type 'xxxMapper' that could not be found问题

A:添加@MapperScan("com.xxx.xxx"),检查service的impl类有没有添加@service注解

3.本地数据库连接不上,报错

2003 - Can't connect to MySQL server on '127.0.0.1' (61 "Connection refused")

A:

关闭mysql服务:苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务(点击stop mysql server)或者使用命令:sudo /usr/local/mysql/support-files/mysql.server stop,强制关闭;

进入终端输入:cd /usr/local/mysql/bin

回车后 登录管理员权限 sudo su  (输入你电脑的密码)

回车后输入以下命令来禁止mysql验证功能: ./mysqld_safe --skip-grant-tables

回车后mysql会自动重启(偏好设置中mysql的状态会变成running)

输入命令 ./mysql

回车后,输入命令 FLUSH PRIVILEGES;

回车后,输入命令 ALTER user 'root'@'localhost' IDENTIFIED BY '123456'

重启mysql:sudo /usr/local/mysql/support-files/mysql.server restart

4.SpringBoot 查询时间数据 数据库和返回数据相差8个小时,解决办法

public class ArticleListVo {

    private Long articleId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")

    private Date createTime;

}

5.springboot中配置addResourceHandler和addResourceLocations,springboot无法读取静态资源

找到继承WebMvcConfigurationSupport的类,配置如下:

@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/");

}

swagger如果没有用到,可以删除

6.接口返回$ref":"$.data.***

FastJson的JSONArray类型作为返回数据,当像JSONArray对象中添加JSONObject对象,而JSONObject对象中包含相同的节点数据时,FastJson会防止返回数据栈溢出的问题,自动将JSONArray中相同的节点数据使用引用方式代替。将返回的List转Object,JSONArray.toJSON。或者在循环里重新new 一个对象,用new 出来的对象放到子list

相关文章

  • Error Records

    1. Description:Failed to configure a DataSource: no embed...

  • records

    遥远的时刻每天都在询问我, “这是窗户吗?”“这是生活吗?”我说 “是”,但其实我心里想说,“我不知道”,我不知道...

  • Records

    终于结束了《全球通史》下的阅读。粗略的读完了上下两本厚厚的史书后,见识与事物思考的宽度都不同了,虽是也有些不懂,通...

  • Records

    Record是“each of”类型,先熟悉,然后将它与另一个“each of”类型Tuple对比。 构建 语法(...

  • mac - python环境修改

    —— Just for personal records.

  • Interview records

    20170905 maxus tao chassis packaging engineer 1.need to s...

  • ECM Records

  • Technical Records

    20/12/2018 超辐射LED(Superluminescent LED, SLED): 结合激光器和LED最...

  • Email records

    Hi Jim Please find attached pictures Fan quoted you the t...

  • Living expense account book

    This is an application that records the income and expens...

网友评论

      本文标题:Error Records

      本文链接:https://www.haomeiwen.com/subject/tprlfhtx.html