gpt4 book ai didi

java - 无法使用网关 UI 将数据保存到 JHipster 微服务中

转载 作者:行者123 更新时间:2023-11-30 06:20:04 24 4
gpt4 key购买 nike

我使用一个微服务和一个网关设置了我的微服务应用程序。我使用 $jhipster import-jdl books.jh 命令和网关中的实体 UI 生成了微服务实体。网关中的 JDL 文件与“skipServer”等选项略有不同。我使用下面的文件为网关中的实体以及微服务中生成的实体生成 UI。我正在查看其他人提出的所有文档和问题,但我找不到正确的文档来使用微服务和 UI 为网关中的这些实体生成实体(需要在 JDL 文件中指定微服务的路径)。如果我的语法不正确,请纠正我。一切顺利,当打开我的实体页面并尝试保存对象时,它没有保存它。我在控制台上收到以下错误。

POST http://localhost:8080/api/addresses 404 error (not found)

图书微服务JDL文件:

entity Address
{
streetName String required,
apartmentOrHouseNumber String,
city String required,
zipcode Long required,
state String,
country String
}

entity BookCoverType
{
coverType String required
}


entity Author
{
firstName String required,
lastName String required,
middleName String,
}

entity Book
{
bookName String required,
bookTitle String required,
numberOfPages Integer required,
}






relationship OneToOne
{
//Book{bookCoverType(coverType)} to BookCoverType
Author{address(streetName)} to Address
}

relationship OneToMany
{
BookCoverType{book(bookTitle)} to Book
Book{author(firstName)} to Author
Author{book(bookTitle)} to Book

}


paginate Book with pagination
paginate Author with pagination

BookStore 网关 JDL 文件:

entity Address
{
streetName String required,
apartmentOrHouseNumber String,
city String required,
zipcode Long required,
state String,
country String
}

entity BookCoverType
{
coverType String required
}


entity Author
{
firstName String required,
lastName String required,
middleName String,
}

entity Book
{
bookName String required,
bookTitle String required,
numberOfPages Integer required,
}




relationship OneToOne
{
//Book{bookCoverType(coverType)} to BookCoverType
Author{address(streetName)} to Address
}

relationship OneToMany
{
BookCoverType{book(bookTitle)} to Book
Book{author(firstName)} to Author
Author{book(bookTitle)} to Book

}

skipServer *
microservice * with books

paginate Book with pagination
paginate Author with pagination

JHipster版本:4.13.3

JHipster 信息:

Using JHipster version installed globally
Executing jhipster:info
Options:

Just found a `.yo-rc.json` in a parent directory.
Setting the project root at: /Users/pjadda/kubernetesapps/bookstore
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**

bookstore@0.0.0 /Users/pjadda/kubernetesapps/bookstore
└── generator-jhipster@4.13.3



##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**


<details>
<summary>.yo-rc.json file</summary>
<pre>
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.bookstore"
},
"jhipsterVersion": "4.13.3",
"baseName": "bookstore",
"packageName": "com.bookstore",
"packageFolder": "com/bookstore",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": true,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": true,
"clientPackageManager": "yarn",
"applicationType": "gateway",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}
</pre>
</details>


##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>
entity Address (address) {
streetName String required,
apartmentOrHouseNumber String,
city String required,
zipcode Long required,
state String,
country String
}
entity BookCoverType (book_cover_type) {
coverType String required
}
entity Author (author) {
firstName String required,
lastName String required,
middleName String
}
entity Book (book) {
bookName String required,
bookTitle String required,
numberOfPages Integer required
}

relationship OneToOne {
Author{address(streetName)} to Address
}
relationship OneToMany {
Book{author} to Author{book},
BookCoverType{book} to Book{bookCoverType},
Author{book} to Book{author}
}

paginate Author, Book with pagination

</pre>
</details>


##### **Environment and Tools**

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

git version 2.13.1

node: v8.9.3

npm: 5.6.0

bower: 1.8.2

yarn: 1.3.2

Docker version 17.12.0-ce, build c97c6d6

docker-compose version 1.18.0, build 8dd22a9

Congratulations, JHipster execution is complete!
Address.json

{
"fluentMethods": true,
"relationships": [],
"fields": [
{
"fieldName": "streetName",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "apartmentOrHouseNumber",
"fieldType": "String"
},
{
"fieldName": "city",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "zipcode",
"fieldType": "Long",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "state",
"fieldType": "String"
},
{
"fieldName": "country",
"fieldType": "String"
}
],
"changelogDate": "20180119060434",
"entityTableName": "address",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"skipServer": true
}

浏览器和操作系统

macOS High Sierra, Chrome browser

最佳答案

JDL 文档对此并不清楚。您可以为此使用一个 JDL 文件并在其中指定一个微服务名称。删除skipServer选项,因为JHipster会自动为你做这件事。关注 this discussion on Github .

更新的 JDl 文件:

entity Address
{
streetName String required,
apartmentOrHouseNumber String,
city String required,
zipcode Long required,
state String,
country String
}

entity BookCoverType
{
coverType String required
}


entity Author
{
firstName String required,
lastName String required,
middleName String,
}

entity Book
{
bookName String required,
bookTitle String required,
numberOfPages Integer required,
}




relationship OneToOne
{
//Book{bookCoverType(coverType)} to BookCoverType
Author{address(streetName)} to Address
}

relationship OneToMany
{
BookCoverType{book(bookTitle)} to Book
Book{author(firstName)} to Author
Author{book(bookTitle)} to Book

}


microservice * with books

paginate Book with pagination
paginate Author with pagination

关于java - 无法使用网关 UI 将数据保存到 JHipster 微服务中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48344922/

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