SpringBoot踩坑⽇记
1.Closing JPA EntityManagerFactory for persistence unit 'default'错误导致springboot启动后终⽌
------------------->
2019-01-22 17:18:34.941  INFO 42978 --- [      Thread-13] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2019-01-22 17:18:34.945  INFO 42978 --- [      Thread-13] com.zaxxer.hikari.HikariDataSource      : HikariPool-1 -
2019-01-22 17:18:35.181  INFO 42978 --- [      Thread-13] com.zaxxer.hikari.HikariDataSource      : HikariPool-1 - Shutdown completed.
解决办法
在依赖中添加spring-boot-starter-web
例如Gradle在adle中添加
implementation 'org.springframework.boot:spring-boot-starter-web'
问题解决
<------------------- 2019.1.22
2.Gradle加载依赖很慢,换成国内源
--------------->
repositories {
//使⽤国内源下载依赖
maven { url 'maven.aliyun/nexus/content/groups/public/' }
mavenCentral()
}
替换之后重新Gradle下
<----------------2019-01-23
3.Gradle加载出错,错误如下
startup failed:
build file '/Users/cuifuan/workspaces/springcloud-tools/adle': 4: all buildscript {} blocks must appear before any plugins {} blocks in the script
See /5.0/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
@ line 4, column 1.
buildscript {
^
1 error
Open File
经过⼀番排查
//删去下⾯代码,如果存在,我也不知道为什么
plugins {
id 'java'
}
4.feign依赖不存在
feign 声明式调⽤
Feign makes writing java http clients easier
之前安装依赖
dependencies{
compile "org.springframework.cloud:spring-cloud-starter-feign"
compile "org.springframework.cloud:spring-cloud-starter-eureka"
}
springboot2.0之后
dependencies {
implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
implementation 'org.springframework.cloud:spring-cloud-starter-eureka-server'
}
5. comflix.client.ClientException: Load balancer does not have available server for client: sp
dependencies {
implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
//应是eureka-client
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
}springcloud和springboot
6.解决报错 javax.persistence.TransactionRequiredException: Executing an update/delete query
运⾏报错原因:少了⼀个注解:@Transactional :要求开启事物管理

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。