[英]How to import spring configuration?
我有这个项目结构:
为了成功导入,我可以在@ContextConfiguration(locations = { "what I must write here?" })
?
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/spring_config.xml")
您还可以将文件移动到资源文件夹:
您可以将Spring配置文件存储在类路径(例如src / main / resources)中,然后通过类路径引用它们。
@ContextConfiguration("classpath:/WEB-INF/spring/spring_config.xml")
首先,您需要将webapp
添加为源文件夹,以便WEB-INF
在类路径的顶部可用(因为它将在已部署的应用程序中)。 然后,您可以使用/WEB-INF/spring/security_config.xml
。
另外,有些人更喜欢将其XML文件放在src/main/resources
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.