SpringBoot中出现的错误

1.Field boy in com.huhu.SpringDemo.HelloController required a bean of type 'com.huhu.SpringBean.Boy' that could not be found.

解决办法:

1.将这个类放到与Spring boot的启动类需要放在需要扫描类的上层目录,这样才能扫描到同级或者子类需要注册的类。 

2.在你使用的Controller上面加上@ComponentScan(basePackages="com.xx"),basePackages注意范围,太大不行,太耗时间了,太小扫描不到

2.There was an unexpected error (type=Internal Server Error, status=500).Circular view path [hello]: would dispatch back to the current handler URL [/boot/hello] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

解决办法:给Controller加上@Controller和@ResponseBody

最近在学习,会持续更新。

原文地址:https://www.cnblogs.com/huhu1203/p/7640495.html