我试图从application.yml文件加载一个字符串数组.这是配置:
ignore:
filenames:
- .DS_Store
- .hg
Run Code Online (Sandbox Code Playgroud)
这是班级:
@Value("${ignore.filenames}")
private List<String> igonoredFileNames = new ArrayList<>();
Run Code Online (Sandbox Code Playgroud)
在同一个类中还有其他配置加载就好了.我的yaml文件中没有选项卡.我仍然得到以下异常:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'ignore.filenames' in string value "${ignore.filenames}"
Run Code Online (Sandbox Code Playgroud) 我遇到了Spring 3提供的两个注释(@Component和@Configuration)我对它们感到有些困惑.
这是我读到的关于@Component的内容
把这个"context:component"放在bean配置文件中,就意味着,在Spring中启用自动扫描功能.base-package指示存储组件的位置,Spring将扫描此文件夹并找出bean(使用@Component注释)并将其注册到Spring容器中.
所以我想知道@Configuration的用途是什么,如果@Controller将注册我的bean而不需要在spring配置xml文件中声明它们