Polishing
This commit is contained in:
parent
7af9910244
commit
cc7c90cca5
|
@ -160,13 +160,13 @@ public abstract class MvcNamespaceUtils {
|
||||||
* Registers a {@link SimpleControllerHandlerAdapter} under a well-known
|
* Registers a {@link SimpleControllerHandlerAdapter} under a well-known
|
||||||
* name unless already registered.
|
* name unless already registered.
|
||||||
*/
|
*/
|
||||||
private static void registerSimpleControllerHandlerAdapter(ParserContext cxt, @Nullable Object source) {
|
private static void registerSimpleControllerHandlerAdapter(ParserContext context, @Nullable Object source) {
|
||||||
if (!cxt.getRegistry().containsBeanDefinition(SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME)) {
|
if (!context.getRegistry().containsBeanDefinition(SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME)) {
|
||||||
RootBeanDefinition beanDef = new RootBeanDefinition(SimpleControllerHandlerAdapter.class);
|
RootBeanDefinition beanDef = new RootBeanDefinition(SimpleControllerHandlerAdapter.class);
|
||||||
beanDef.setSource(source);
|
beanDef.setSource(source);
|
||||||
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
cxt.getRegistry().registerBeanDefinition(SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME, beanDef);
|
context.getRegistry().registerBeanDefinition(SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME, beanDef);
|
||||||
cxt.registerComponent(new BeanComponentDefinition(beanDef, SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME));
|
context.registerComponent(new BeanComponentDefinition(beanDef, SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ public abstract class MvcNamespaceUtils {
|
||||||
/**
|
/**
|
||||||
* Find the {@code ContentNegotiationManager} bean created by or registered
|
* Find the {@code ContentNegotiationManager} bean created by or registered
|
||||||
* with the {@code annotation-driven} element.
|
* with the {@code annotation-driven} element.
|
||||||
* @return a bean definition, bean reference, or {@code null}
|
* @return a bean definition, bean reference, or {@code null} if none defined
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Object getContentNegotiationManager(ParserContext context) {
|
public static Object getContentNegotiationManager(ParserContext context) {
|
||||||
|
@ -234,12 +234,11 @@ public abstract class MvcNamespaceUtils {
|
||||||
/**
|
/**
|
||||||
* Load the {@link Resource}'s for the given locations with the given
|
* Load the {@link Resource}'s for the given locations with the given
|
||||||
* {@link ResourceLoader} and add them to the output list. Also for
|
* {@link ResourceLoader} and add them to the output list. Also for
|
||||||
* {@link org.springframework.core.io.UrlResource URL-based resources} (e.g.
|
* {@link org.springframework.core.io.UrlResource URL-based resources} (e.g. files,
|
||||||
* files, HTTP URLs, etc) this method supports a special prefix to indicate
|
* HTTP URLs, etc) this method supports a special prefix to indicate the charset
|
||||||
* the charset associated with the URL so that relative paths appended to it
|
* associated with the URL so that relative paths appended to it can be encoded
|
||||||
* can be encoded correctly, e.g.
|
* correctly, e.g. {@code [charset=Windows-31J]http://example.org/path}.
|
||||||
* {@code [charset=Windows-31J]http://example.org/path}. The charsets, if
|
* The charsets, if any, are added to the output map.
|
||||||
* any, are added to the output map.
|
|
||||||
* @since 4.3.13
|
* @since 4.3.13
|
||||||
*/
|
*/
|
||||||
public static void loadResourceLocations(String[] locations, ResourceLoader resourceLoader,
|
public static void loadResourceLocations(String[] locations, ResourceLoader resourceLoader,
|
||||||
|
|
|
@ -168,8 +168,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
|
|
||||||
String locationAttr = element.getAttribute("location");
|
String locationAttr = element.getAttribute("location");
|
||||||
if (!StringUtils.hasText(locationAttr)) {
|
if (!StringUtils.hasText(locationAttr)) {
|
||||||
String message = "The 'location' attribute is required.";
|
context.getReaderContext().error("The 'location' attribute is required.", context.extractSource(element));
|
||||||
context.getReaderContext().error(message, context.extractSource(element));
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue