org.yaml.snakeyaml.constructor.SafeConstructor: method <init>()V not found
时间: 2024-06-17 07:03:41 浏览: 15
org.yaml.snakeyaml.constructor.SafeConstructor是一个类,而method <init>()V not found是指这个类的构造函数没有找到。这个错误通常出现在使用了错误的版本的snakeyaml库或者在代码中调用了不存在的构造函数。您可以检查一下您使用的snakeyaml库的版本是否正确,或者检查代码中是否存在调用不存在的构造函数的情况。如果您需要更具体的帮助,请提供更多的上下文信息。
相关问题
org.yaml.snakeyaml.representer.Representer: method <init>()V not found
这个错误提示表明在使用org.yaml.snakeyaml.representer.Representer类时,没有找到无参构造方法。解决方法是重写该类并增加无参构造方法。具体步骤如下:
1. 创建一个新的类,继承org.yaml.snakeyaml.representer.Representer类。
2. 在新类中增加一个无参构造方法。
3. 在无参构造方法中调用父类的有参构造方法。
4. 使用新类代替原来的Representer类即可。
```java
public class CustomRepresenter extends Representer {
public CustomRepresenter() {
super();
}
}
```
springboot 配置文件用properties不报错,改为yml格式 报错:org.yaml.snakeyaml.representer.Representer: method <init>()V not found
这个错误是因为在使用yml格式的配置文件时,缺少了snakeyaml库的依赖。可以在pom.xml文件中添加以下依赖来解决这个问题:
```
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
```
其中,${snakeyaml.version}是你所使用的snakeyaml库的版本号。添加完依赖后,重新编译运行即可。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)