各种报错(1)

报错解决:Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}

报错原因:
程序中指定的 http://localhost:8088/eureka 注册中心地址无效,而用了springcloud默认的注册中心地址–http://localhost:8761/eureka

报错解决:
检查application.yml文件,defaultZone属性识别不到,是不是拼写错误,在配置中格式没对齐也要排查。

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Maven: Failed to read artifact descriptor

<package>标签显示有这个错,<dependency>里的依赖本来springboot是会自动安装的,但我是断网了,回复的时候它不能重新安装,删了<dependency>,重写就问题了。

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@RestController@Controller

1) @RestController相当于@Controller+@ResponseBody两个注解的结合,返回json数据不需要在方法前面加@ResponseBody注解了,但Controller中的方法无法返回jsp页面,或者html,配置的视图解析器 InternalResourceViewResolver不起作用,返回的内容就是Return 里的内容。

 

2) 如果需要返回到指定页面,则需要用 @Controller配合视图解析器InternalResourceViewResolver才行。
    如果需要返回JSON,XML或自定义mediaType内容到页面,则需要在对应的方法上加上@ResponseBody注解。

====================================================================================================

 

 

idea项目中导入了lombok包,但是使用@AllArgsConstructor@NoArgsConstructor@Getter注解还是无效?

 

idea使用lombok需要安装对应插件,在File -> Setting -> Plugins中搜索lombok安装对应插件,即可使用。

 ========================================================================================================================================

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

链接mysql报的警告,大概意思:不建议在没有服务器身份验证的情况下建立SSL连接,根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果没有设置显式选项,则必须默认建立SSL连接。为了符合不使用SSL的现有应用程序,verifyServerCertificate属性被设置为“false”。您需要通过设置useSSL=false显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储。

加参数解决: jdbc:mysql://localhost:3306/db?characterEncoding=utf-8&useSSL=false

 

?characterEncoding=utf-8&useSSL=false

 

=========================================================================================================================================================

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

网上很多人说是密码错误,其实不是,而是配置yml文件时,我是直接复制的别人的,网上大多数人也都配的

datasource:
url: jdbc:mysql://localhost:3360
name: root
password: root
driver-class-name: com.mysql.jdbc.Driver

我重写,根据提示配置登入用户,是用username,解决问题

=====================================================================================================================================================

org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available parameters are [bid, param1, cid, param2]
看代码如果没有@Param就会报这个错,注解里的sql写错也会报,比如写成:INSERT INTO tb_category_brand VALUES (#{cid},#{id})
@Insert("INSERT INTO tb_category_brand (category_id, brand_id) VALUES (#{cid},#{bid})")
int insertCategoryAndBrand(@Param("cid") Long cid, @Param("bid") Long bid);
 
posted @ 2021-08-24 11:06  mestery偲  阅读(432)  评论(0)    收藏  举报