遇到的各种java问题

1.Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix.    highlight_spring4        line 1    Maven Configuration Problem
 解决:  alt+f5  右键项目 点maven_> update
2.No qualifying bean of type [com.wisely.highlight_spring4.ch1.aop.DemoAnnotationService] is defined
 解决:我的配置文件写错了。
3.the import org.junit cannot be resolved..
解决:删除出错的JAR包,然后右键项目 点maven_> update重新下载
4. SocketTimeoutException: Read timed out
解决:修改超时时间限制或者让网速好一点

5.解决Maven报Plugin execution not covered by lifecycle configuration
解决:https://blog.csdn.net/xxd851116/article/details/25197373 可以参考

6.List/ArrayList  cannot be resolved to a type!的问题

解决:可能是忘了导入包,添加:import java.util.*;

7.thymeleaf模板报错Only variable expressions returning numbers or booleans are allowed in this。。。。

解决:我们需要了解thymeleaf的一种获取值得方法:[[${xx.name}]],可以直接获取xx里面的name值.

<button class="btn" th:onclick="'getName(\''+${person.name}+'\');'">获得名字</button>

改为:

<button class="btn" th:onclick="getName([[${person.name}]]);">获得名字</button>

参考链接:https://blog.csdn.net/Lactually/article/details/84306960

8.List<Person> persons=new ArrayList<Person>();的理解

List 是集合 ,下面有arrayList ,linkedlist ,

List<Person> persons=new ArrayList<Person>();等同于ArrayList<Person> persons=new ArrayList<Person>();

<Person> 是说List里面放入的是person对象 。ArrayList :数组链表,链表按数组形式存储元素。
new ArrayList<Person>():创建一个链表,<>表示链表内放Person类型数据。

List:链表抽象类,是ArrayList父类
List<Person> persons:一个List引用。

9.报错org.apache.catalina.LifecycleException: Protocol handler start failed

解决:Tomcat端口号被占用,修改端口号即可。

我的是springboot项目,在应用的application.properties或者yml配置文件中,添加配置项即可

#指定服务端口
server.port=xxxx

10.eclipse中查看某些函数或自带函数的源码

解决:F3

q

猜你喜欢

转载自blog.csdn.net/qq_40604853/article/details/84139856