IDEA创建第三个之后的Maven Module的resources文件夹之坑

600 阅读1分钟

一、关于启动项目的报错

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'aliyun.oss.file.endpoint' in value "${aliyun.oss.file.endpoint}"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'constantOssUtils': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'aliyun.oss.file.endpoint' in value "${aliyun.oss.file.endpoint}"

1、constantOssUtils这个常量工具类创建错误

constantOssUtils:这个类在Spring容器中创建时候,找不到这个值(${aliyun.oss.file.endpoint}

一开始我在创建项目时候,分别在OSS(文件上传)和VOD(视频上传)建立两个相同名称的ConstantUtils工具类,来对文件上传和视频上传所需一些阿里云常量进行赋值,我以为在进行包扫描的时候发生了冲突导致后运行的项目创建失败。后来我才发现 是IDEA创建文件时候这个resources文件夹的原因:

解决方案: 右键选择该项目——>Open Module Settings

resources该有的样子