Spring boot 学习笔记
一、ArtifactTransferException: Failure to transfer
eclipse 在导入maven project后,pom.xml有可能出现这种错误。
这里update maven project解决了;右键点击Maven项目->Maven->Update project,在弹出的窗口下方把Force Update of Snapshots/Releases勾上,ok了!
二、解决SocketTimeoutException: connect timed out问题
解决办法:
1、windows→preferences→Spring→Bean Support
第一种解决办法截图
网上大多给的都是这种办法,但是可能网速不好,创建许多次,才能有一次幸运地创建成功,于是我又找了另外的方法
2、将https://start.spring.io换成阿里云的地址:https://start.aliyun.com/
第二种解决办法截图
三、Whitelabel Error Page错误信息
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Jun 24 14:56:23 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
IDEA目录结构的问题,Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 。而我的controller则放在了最外层的包里面。导致找不到页面。
解决方法1,移动控制层的包:
把controller类移动进去,即可成功运行。
解决方法二,添加@SpringBootApplication(scanBasePackages=“controller”)
在你的启动的Demo01Application类中,添加注释,指定你的controller的位置,就可以指定加载,成功解决问题。
package com.hh.demo01;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages=“controller”)
public class Demo01Application {
public static void main(String[] args) {
SpringApplication.run(Demo01Application.class, args);
}
}