gpt4 book ai didi

java - 通过 IntellIj 运行 gradle 应用程序

转载 作者:行者123 更新时间:2023-11-30 02:27:25 26 4
gpt4 key购买 nike

当我通过命令 linie (gradlew) 运行应用程序 (jHipster) 时,一切正常,但是当我尝试使用 IntelIJ 运行应用程序时(通过按钮) enter image description here

我有一个错误:

2017-07-24 21:43:13.313 DEBUG 4312 --- [  restartedMain] c.e.c.E.p.t.d.S.preferredDivisions       : Close successful.
2017-07-24 21:43:13.493 ERROR 4312 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 1 of constructor in com.patres.timetable.service.DivisionService required a bean of type 'com.patres.timetable.service.mapper.DivisionMapper' that could not be found.


Action:

Consider defining a bean of type 'com.patres.timetable.service.mapper.DivisionMapper' in your configuration.


Process finished with exit code 0

我的所有类(class)都是由 jHipster 生成的。例如 DivisionMapper 看起来像这样:

@Mapper(componentModel = "spring", uses = {UserMapper.class, TeacherMapper.class, SubjectMapper.class, })
public interface DivisionMapper extends EntityMapper <DivisionDTO, Division> {

@Mapping(target = "timetables", ignore = true)
@Mapping(target = "divisionPlaces", ignore = true)
@Mapping(target = "divisionTeachers", ignore = true)
@Mapping(target = "divisionSubjects", ignore = true)
@Mapping(target = "divisionLessons", ignore = true)
@Mapping(target = "divisionPeriods", ignore = true)
@Mapping(target = "divisionProperties", ignore = true)
@Mapping(target = "preferredPlaces", ignore = true)
Division toEntity(DivisionDTO divisionDTO);
default Division fromId(Long id) {
if (id == null) {
return null;
}
Division division = new Division();
division.setId(id);
return division;
}
}

有人可以向我解释一下吗?对于同样的错误,我无法在 IDE 中运行单元测试

逐步重现问题:

1)生成jhipster应用程序:

{
"generator-jhipster": {
"promptValues": {
"packageName": "com.patres.timetable",
"nativeLanguage": "en"
},
"jhipsterVersion": "4.6.2",
"baseName": "Test",
"packageName": "com.patres.timetable",
"packageFolder": "com/patres/timetable",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "ehcache",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "postgresql",
"prodDatabaseType": "postgresql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "gradle",
"enableSocialSignIn": false,
"jwtSecretKey": "18817051906d7b75a7c8c96ac82de44228e55742",
"clientFramework": "angularX",
"useSass": true,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en",
"pl"
]
}
}

2)生成简单实体

entity Division {
name String required,
shortName String,
numberOfPeople Long,
colorBackground String,
colorText String
}

paginate all with pagination
service all with serviceClass

dto * with mapstruct

3)在application-dev.yml中配置数据库

4)在 IntelliJ 中运行时出现错误(但使用命令行 gradlew 一切正常)

5) 通过此示例链接到 github https://github.com/Patresss/jHipster

最佳答案

只是一点更新:

plugins {
id 'net.ltgt.apt-idea' version '0.13'
}

apply plugin: 'idea'
apply plugin: "net.ltgt.apt"

dependencies {
apt "org.mapstruct:mapstruct-processor:${mapstruct_version}"
apt "org.hibernate:hibernate-jpamodelgen:${hibernate_version}"
}

关于java - 通过 IntellIj 运行 gradle 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45288876/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com