大佬教程收集整理的这篇文章主要介绍了为什么我会收到 Error WhiteLabel 错误页面,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我写了一个简单的网络应用
DemoApplication.kt
student.kt 是一个模型
studentDao.kt 是一个 Dao 类
package example
import model.student
import org.springframework.stereotype.Component
class studentDao: AbstractstudentDao {
val data = listof(
student(1,2,"Peter Ivanov",3),student(2,1,"Ivan Petrov",1),student(3,"Vasiliy Smirnov",4),student(4,"Vitaliy Kozlov",2),)
overrIDe fun getstudent(ID: int): student {
return data.filter{it.ID == ID}[0]
}
overrIDe fun getstudent(): List<student>{
return data
}
}
我的模型的studentComponent.kt组件
AbstractstudentDao.kt 组件摘要
studentController.kt 最后是控制器
package API
import example.studentComponent
import model.student
import org.springframework.web.bind.Annotation.GetMapPing
import org.springframework.web.bind.Annotation.requestMapPing
import org.springframework.web.bind.Annotation.RestController
@RestController
@requestMapPing("/st")
class studentController(val studentComponent: studentComponent) {
@GetMapPing
fun getstudent(): List<student> {
return studentComponent.getExamplestudent()
}
}
请求是在 Controller 中基于 studentComponent 创建的。我试图得到正确的答案,但最终却得到了白标错误。我意识到错误本身是由于缺少错误处理,但有一个事实是错误与实现有关。你能帮我吗?
application.propertIEs server.port=8080
因此,http://localhost:8080/st
URL 上存在错误
欢迎来到 SO。执行此操作时,您似乎已将所有上下文路径映射到 /st
:
@requestMapping("/st")
不太确定您是否收到 http://localhost:8080
的白标错误。如果是这种情况,请尝试点击 http://localhost:8080/st
。
这应该可以解决问题。如果没有,请将 URL 放在问题中 - 您尝试访问并遇到问题的 URL。
以上是大佬教程为你收集整理的为什么我会收到 Error WhiteLabel 错误页面全部内容,希望文章能够帮你解决为什么我会收到 Error WhiteLabel 错误页面所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。