Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

后端手册-》新建模块-》③ 【必选】新建 cn.iocoder.yudao.module.demo 基础包中的controller.user有误导性,建议改为controller.app #746

Closed
wanghannew1 opened this issue Jan 24, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@wanghannew1
Copy link

https://doc.iocoder.cn/module-new/#_3-%E6%96%B0%E5%BB%BA-demo-biz-%E5%AD%90%E6%A8%A1%E5%9D%97

初学者按照后端手册的新建模块章节操作时,在未弄清controller.app包与/app-api/访问路径的映射关系时,容易错将③ 【必选】新建 cn.iocoder.yudao.module.demo 基础包中的controller.user当成controller.app,把AppDemoTestController写到user包中。

基本信息

  • ruoyi-vue-pro 版本:2.3.0-jdk8-SNAPSHOT
  • 操作系统:Windows 11 专业版 21H2
  • 数据库:MySQL 8.0.39

你猜测可能的原因

初学者可能会按照controller.user创建软件包,并将本应在controller.app包中的AppDemoTestController错放入controller.user包中,导致访问/app-api/demo/test/get地址报404错误

复现步骤

第一步,"③ 【必选】新建 cn.iocoder.yudao.module.demo 基础包,其中 demo 为模块名。之后,新建 controller.admin 和 controller.user"

第二步,没有仔细看第4小节”新建 RESTful API 接口“中写的包名,在 controller.user 包,”新建一个 AppDemoTestController 类,并新建一个 /demo/test/get 接口。"

第三步,按照后续步骤进行测试,结果在测试文档(http://127.0.0.1:48080/doc.html)中找不到“用户 App - Test”项,用api工具测试报404 Not Found错误。
ps:http://127.0.0.1:48080/doc.html中的测试项没有按字母排序,比较难找。

报错信息

Image

Image

@YunaiV
Copy link
Owner

YunaiV commented Jan 24, 2025

感谢,我修改下哈!

@sc7697
Copy link

sc7697 commented Jan 27, 2025

后端手册-》新建模块
按照后端手册的新建模块章节操作时,启动后 Swagger 接口文档中未显示,并且测试接口返回404,原因是在yudao-server的中未引用。
建议加上module为 yudao-server 的pom中加入
<dependency> <groupId>cn.iocoder.boot</groupId> <artifactId>yudao-module-demo-biz</artifactId> <version>${revision}</version> </dependency>

@YunaiV
Copy link
Owner

YunaiV commented Feb 8, 2025

后端手册-》新建模块 按照后端手册的新建模块章节操作时,启动后 Swagger 接口文档中未显示,并且测试接口返回404,原因是在yudao-server的中未引用。 建议加上module为 yudao-server 的pom中加入 <dependency> <groupId>cn.iocoder.boot</groupId> <artifactId>yudao-module-demo-biz</artifactId> <version>${revision}</version> </dependency>

这个写了呀。

@YunaiV YunaiV closed this as completed Feb 8, 2025
@YunaiV YunaiV self-assigned this Feb 8, 2025
@YunaiV YunaiV added the bug Something isn't working label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants