spring boot正常啓動了,但是瀏覽器一直報404.,原因是spring boot只會掃描啓動類當前包和以下的包 。 如果將 spring boot 放在 包 com.example.controller 裏面的話 ,它會掃描 com.example.controller 和 com.example.controller.* 裏面的所有的 ;
還有一種解決方案是 在啓動類的上面添加 @ComponentScan(basePackages = {"com.example.*"})
spring boot正常啓動了,但是瀏覽器一直報404.,原因是spring boot只會掃描啓動類當前包和以下的包 。 如果將 spring boot 放在 包 com.example.controller 裏面的話 ,它會掃描 com.example.controller 和 com.example.controller.* 裏面的所有的 ;
還有一種解決方案是 在啓動類的上面添加 @ComponentScan(basePackages = {"com.example.*"})