|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2014 the original author or authors. |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -63,11 +63,9 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
implements Ordered, InitializingBean, DisposableBean { |
|
|
|
implements Ordered, InitializingBean, DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
/** The default basename if no other basename is supplied. */ |
|
|
|
/** The default basename if no other basename is supplied. */ |
|
|
|
public final static String DEFAULT_BASENAME = "views"; |
|
|
|
public static final String DEFAULT_BASENAME = "views"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String[] basenames = new String[] {DEFAULT_BASENAME}; |
|
|
|
private String[] basenames = new String[] {DEFAULT_BASENAME}; |
|
|
|
|
|
|
|
|
|
|
|
private ClassLoader bundleClassLoader = Thread.currentThread().getContextClassLoader(); |
|
|
|
private ClassLoader bundleClassLoader = Thread.currentThread().getContextClassLoader(); |
|
|
|
@ -76,6 +74,8 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
|
|
|
|
|
|
|
|
private Locale[] localesToInitialize; |
|
|
|
private Locale[] localesToInitialize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
|
|
|
|
|
|
|
|
|
|
|
|
/* Locale -> BeanFactory */ |
|
|
|
/* Locale -> BeanFactory */ |
|
|
|
private final Map<Locale, BeanFactory> localeCache = |
|
|
|
private final Map<Locale, BeanFactory> localeCache = |
|
|
|
new HashMap<Locale, BeanFactory>(); |
|
|
|
new HashMap<Locale, BeanFactory>(); |
|
|
|
@ -85,15 +85,6 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
new HashMap<List<ResourceBundle>, ConfigurableApplicationContext>(); |
|
|
|
new HashMap<List<ResourceBundle>, ConfigurableApplicationContext>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setOrder(int order) { |
|
|
|
|
|
|
|
this.order = order; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int getOrder() { |
|
|
|
|
|
|
|
return this.order; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set a single basename, following {@link java.util.ResourceBundle} conventions. |
|
|
|
* Set a single basename, following {@link java.util.ResourceBundle} conventions. |
|
|
|
* The default is "views". |
|
|
|
* The default is "views". |
|
|
|
@ -175,6 +166,20 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
this.localesToInitialize = localesToInitialize; |
|
|
|
this.localesToInitialize = localesToInitialize; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Specify the order value for this ViewResolver bean. |
|
|
|
|
|
|
|
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. |
|
|
|
|
|
|
|
* @see org.springframework.core.Ordered#getOrder() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setOrder(int order) { |
|
|
|
|
|
|
|
this.order = order; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int getOrder() { |
|
|
|
|
|
|
|
return this.order; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Eagerly initialize Locales if necessary. |
|
|
|
* Eagerly initialize Locales if necessary. |
|
|
|
* @see #setLocalesToInitialize |
|
|
|
* @see #setLocalesToInitialize |
|
|
|
|