Is the "classpath:" prefix specific to Spring, or is this a JVM concept?
I have this in my web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-config.xml</param-value>
</context-开发者_开发知识库param>
I suspect this is a convention used only by Spring? If it is, will it take my app longer to load, since I'm not specifying a direct file location, but now it must search the entire classpath?
I suspect this is a convention used only by Spring?
Yes, it stands for a ClassPathResource
and is part of Spring's Resource
abstraction
If it is, will it take my app longer to load, since I'm not specifying a direct file location, but now it must search the entire classpath?
No, a) it uses the ClassLoader internally which should be fast enough. b) you don't really have much of a choice. using files is a very bad idea in a webapp context, because it makes you dependent on implementation details that should be left to the implementing App server (a WAR may or may not be unpacked).
精彩评论