类 SimpleUrlHandlerMapping
- java.lang.Object
-
- WebApplicationObjectSupport
-
- org.springframework.web.servlet.handler.AbstractHandlerMapping
-
- org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
-
- org.springframework.web.servlet.handler.SimpleUrlHandlerMapping
-
- 所有已实现的接口:
- HandlerMapping
public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping
Implementation of the
HandlerMapping
interface to map from URLs to request handler beans. Supports both mapping to bean instances and mapping to bean names; the latter is required for non-singleton handlers.The "urlMap" property is suitable for populating the handler map with bean references, e.g. via the map element in XML bean definitions.
Mappings to bean names can be set via the "mappings" property, in a form accepted by the
java.util.Properties
class, like as follows:/welcome.html=ticketController /show.html=ticketController
The syntax isPATH=HANDLER_BEAN_NAME
. If the path doesn't begin with a slash, one is prepended.Supports direct matches (given "/test" -> registered "/test") and "*" matches (given "/test" -> registered "/t*"). Note that the default is to map within the current servlet mapping if applicable; see the
"alwaysUseFullPath"
property for details. For details on the pattern options, see the
org.springframework.util.AntPathMatcher
javadoc.