问题
Most examples of Spring bean IDs use Java-style variable names, such as someBean
. However, that style isn't enforced; in fact, spaces and some other special characters are permitted (as of Spring 3.1 and later). An argument can be made for using more verbose bean IDs, such as:
<bean id="Some Bean" />
So far I've encountered only one issue with using bean IDs like that (see How can I declare a Spring `depends-on` attribute with a bean ID that contains spaces?). Are there any other important ramifications or limitations to consider when choosing bean names with spaces?
来源:https://stackoverflow.com/questions/29125788/are-there-any-considerations-when-using-spring-bean-ids-that-contain-spaces