我不知道为什么我的春靴没有开始



org.springframework.beans.factory.UnsatisfiedDependencyException:创建文件[…\codeService.class]中定义的名称为"codeService"的bean时出错:通过构造函数参数0表示的不满足依赖关系;嵌套异常为org.springframework.beans.factory.BeanCreationException:在平台中创建名为"codeRepository"的bean时出错。在JpaRepositoryRegistrar.EnableJpaRepositoryConfiguration:init方法调用失败;嵌套异常是java.lang.IollegalArgumentException:不是托管类型:类平台。CodeContext

2022-11-19 20:36:42.372 WARN 18200---[main]ConfigServletWebServerApplicationContext:上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.UnsatisfiedDependencyException:创建文件[…\codeService.class]中定义的名称为"codeService"的bean时出错:通过构造函数参数表达的不满足的依赖关系0;嵌套异常为org.springframework.beans.factory.BeanCreationException:在平台中创建名为"codeRepository"的bean时出错。在JpaRepositoryRegistrar.EnableJpaRepositoryConfiguration:init方法调用失败;嵌套异常是java.lang.IollegalArgumentException:不是托管类型:类平台。CodeContext

我有这个eror和这个警告,你知道怎么了吗?

package platform;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CodeRepository extends JpaRepository<CodeContext, Long> {

}
package platform;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@RequiredArgsConstructor
public class CodeService {

private final  CodeRepository codeRepository;
public CodeContext getCodeAt(Long n) {
return codeRepository.findById(n)
.orElseThrow(CodeNotFoundException::new);
}

public List<CodeContext> getLastTen() {
List<CodeContext> temporary = new ArrayList<>();
long lastTen = codeRepository.count();
for (int i = 0; i < 10; i++) {
temporary.add(this.getCodeAt(lastTen));
lastTen--;
if (lastTen <= 0) {
break;
}
}
return temporary;
}
public void saveCode(CodeContext code) {
code.nowTime();
codeRepository.save(code);
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
runtimeOnly 'com.h2database:h2'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
}
server.port=8889
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
spring.main.banner-mode=off
spring.sql.init.platform=h2
spring.datasource.url=jdbc:h2:file:../snippets
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.h2.console.enabled=true
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false

我不知道该怎么办,我试着在谷歌上搜索了一下,但没有找到任何

将@Entity添加到类CodeContext

相关内容

最新更新