Commit Graph

394 Commits

Author SHA1 Message Date
Chris Beams 5a7d2a91ba Introduce ApplicationContextInitializer interface
Designed primarily for use in conjunction with web applications
to provide a convenient mechanism for configuring the container
programmatically.

ApplicationContextInitializer implementations are specified through the
new "contextInitializerClasses" servlet context parameter, then detected
and invoked by ContextLoader in its customizeContext() method.

In any case, the semantics of ApplicationContextInitializer's
initialize(ConfigurableApplicationContext) method require that
invocation occur *prior* to refreshing the application context.

ACI implementations may also implement Ordered/PriorityOrdered and
ContextLoader will sort instances appropriately prior to invocation.

Specifically, this new support provides a straightforward way to
programmatically access the container's Environment for the purpose
of adding, removing or otherwise manipulating PropertySource objects.

See Javadoc for further details.

Also note that ApplicationContextInitializer semantics overlap to
some degree with Servlet 3.0's notion of ServletContainerInitializer
classes. As Spring 3.1 development progresses, we'll likely see
these two come together and further influence one another.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3882 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-07 09:57:57 +00:00
Chris Beams 1f8637d944 Introduce and integrate JndiPropertySource
DefaultWebEnvironment automatically adds a JndiPropertySource if
a "jndiPropertySourceEnabled" property is detected in any of the
other other default property sources.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3869 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-06 07:43:29 +00:00
Chris Beams 0821b2c6c2 Polish (Mutable)PropertySources
* PropertySources is now an Iterable<PropertySource> in favor of
  exposing an asList() method
* Otherwise reduced the set of methods exposed by PropertySources to the
  absolute minimum
* Added Javadoc for both types and all methods

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3865 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-05 22:25:24 +00:00
Chris Beams 835a3f8d64 Refactor Environment and PropertySource
* Environment now extends PropertyResolver
* Environment no longer exposes resolver and sources
* PropertySource is String,Object instead of String,String
* PropertySource no longer assumes enumerability of property names
* Introduced EnumerablePropertySource for those that do have enumerable property names

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3862 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-05 22:24:14 +00:00
Arjen Poutsma dfb8b267ca SPR-7845 - FormHttpMessageConverter.read() always ignores post data when processing request (from Tomcat)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3845 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-04 11:25:30 +00:00
Arjen Poutsma 5f6c1145df SPR-7834 - HttpHeaders.getEtag() mangles the value
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3843 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-03 15:51:23 +00:00
Arjen Poutsma cac2354a85 SPR-7845 - FormHttpMessageConverter.read() always ignores post data when processing request (from Tomcat)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3842 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-03 14:48:34 +00:00
Arjen Poutsma 241e8f12e0 SPR-7845 - FormHttpMessageConverter.read() always ignores post data when processing request (from Tomcat)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3841 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-03 14:38:28 +00:00
Chris Beams d00b49dca5 Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:

    * Easy access to a type hierarchy that can answer the question
      "What *Aware interfaces are available?", without requiring
      text-based searches. Also clearly excludes false positives like
      TargetClassAware and ParamAware, which while similarly named,
      are not semantically similar to traditional *Aware interfaces
      in Spring.

    * Minor potential performance improvements in
      AbstractAutowireCapableBeanFactory and
      ApplicationContextAwareProcessor. Both have blocks of sequential
      instanceof checks in order to invoke any *Aware interface callback
      methods. For a bean that implements none of these interfaces,
      the whole sequence can be avoided by guarding first with
          if (bean instanceof Aware) {
              ...
          }

Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3840 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-03 10:13:57 +00:00
Chris Beams 1ac7b56caf M1 cut of environment, profiles and property work (SPR-7508)
Decomposed Environment interface into PropertySources, PropertyResolver
objects

    Environment interface and implementations are still present, but
    simpler.

    PropertySources container aggregates PropertySource objects;
    PropertyResolver provides search, conversion, placeholder
    replacement. Single implementation for now is
    PropertySourcesPlaceholderResolver

Renamed EnvironmentAwarePropertyPlaceholderConfigurer to
PropertySourcesPlaceholderConfigurer

    <context:property-placeholder/> now registers PSPC by default, else
    PPC if systemPropertiesMode* settings are involved

Refined configuration and behavior of default profiles

    See Environment interface Javadoc for details

Added Portlet implementations of relevant interfaces:

    * DefaultPortletEnvironment
    * PortletConfigPropertySource, PortletContextPropertySource
    * Integrated each appropriately throughout Portlet app contexts

Added protected 'createEnvironment()' method to AbstractApplicationContext

    Subclasses can override at will to supply a custom Environment
    implementation.  In practice throughout the framework, this is how
    Web- and Portlet-related ApplicationContexts override use of the
    DefaultEnvironment and swap in DefaultWebEnvironment or
    DefaultPortletEnvironment as appropriate.

Introduced "stub-and-replace" behavior for Servlet- and Portlet-based
PropertySource implementations

    Allows for early registration and ordering of the stub, then
    replacement with actual backing object at refresh() time.

    Added AbstractApplicationContext.initPropertySources() method to
    support stub-and-replace behavior. Called from within existing
    prepareRefresh() method so as to avoid impact with
    ApplicationContext implementations that copy and modify AAC's
    refresh() method (e.g.: Spring DM).

    Added methods to WebApplicationContextUtils and
    PortletApplicationContextUtils to support stub-and-replace behavior

Added comprehensive Javadoc for all new or modified types and members

Added XSD documentation for all new or modified elements and attributes

    Including nested <beans>, <beans profile="..."/>, and changes for
    certain attributes type from xsd:IDREF to xsd:string

Improved fix for detecting non-file based Resources in
PropertiesLoaderSupport (SPR-7547, SPR-7552)

    Technically unrelated to environment work, but grouped in with
    this changeset for convenience.

Deprecated (removed) context:property-placeholder
'system-properties-mode' attribute from spring-context-3.1.xsd

    Functionality is preserved for those using schemas up to and including
    spring-context-3.0.  For 3.1, system-properties-mode is no longer
    supported as it conflicts with the idea of managing a set of property
    sources within the context's Environment object. See Javadoc in
    PropertyPlaceholderConfigurer, AbstractPropertyPlaceholderConfigurer
    and PropertySourcesPlaceholderConfigurer for details.

Introduced CollectionUtils.toArray(Enumeration<E>, A[])

Work items remaining for 3.1 M2:

    Consider repackaging PropertySource* types; eliminate internal use
    of SystemPropertyUtils and deprecate

    Further work on composition of Environment interface; consider
    repurposing existing PlaceholderResolver interface to obviate need
    for resolve[Required]Placeholder() methods currently in Environment.

    Ensure configurability of placeholder prefix, suffix, and value
    separator when working against an AbstractPropertyResolver

    Add JNDI-based Environment / PropertySource implementatinos

    Consider support for @Profile at the @Bean level

    Provide consistent logging for the entire property resolution
    lifecycle; consider issuing all such messages against a dedicated
    logger with a single category.

    Add reference documentation to cover the featureset.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3839 50f2f4bb-b051-0410-bef5-90022cba6387
2011-01-03 09:04:34 +00:00
Sam Brannen 924b8e11ea [SPR-7850][SPR-7851] Upgraded to JUnit 4.8.1 and TestNG 5.12.1; added changelog entries for 3.1.0.M1.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3838 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-30 08:00:58 +00:00
Chris Beams 7ac69dff5f Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.

A number of classes had strayed from this format, now all
are the same.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3831 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-22 21:40:19 +00:00
Arjen Poutsma a32894ca31 Removed JDK 1.6 usage
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3830 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-22 10:23:34 +00:00
Arjen Poutsma a3583fd5c4 SPR-7789 - FormHttpMessageConverter does not honor the charset in the content type when writing a form and uses a wrong default charset
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3826 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-20 16:56:14 +00:00
Arjen Poutsma bc235c5b03 SPR-7789 - FormHttpMessageConverter does not honor the charset in the content type when writing a form and uses a wrong default charset
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3825 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-20 16:50:44 +00:00
Arjen Poutsma cbdec821c4 SPR-7706 - 304 responses should not have non-0 Content-Length
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3824 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-20 16:32:58 +00:00
David Syer 22f501457e Add missing ROME dep
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3795 50f2f4bb-b051-0410-bef5-90022cba6387
2010-11-15 16:49:17 +00:00
Arjen Poutsma 3e2aaec911 Using random port for HTTP integration tests
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3794 50f2f4bb-b051-0410-bef5-90022cba6387
2010-11-09 10:40:51 +00:00
Arjen Poutsma 334e4eb1e7 SPR-6614 - Add human-readable descriptions for statuc codes in HttpStatus
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3788 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-29 10:56:43 +00:00
Arjen Poutsma 3f2b200e64 SPR-7695 - Add ETag version of WebRequest.checkNotModified()
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3787 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-29 10:28:47 +00:00
Chris Beams 45e5b46fc2 Merge 3.1.0 development branch into trunk
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:

    git merge -s recursive -Xtheirs --no-commit env

No merge conflicts, but did need to

    git rm spring-build

prior to committing.

With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch.  3.1.0 snapshots will be available
per the usual nightly CI build from trunk.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3782 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-25 19:48:20 +00:00
Arjen Poutsma 19224cac2b SPR-7667
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3779 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-20 13:59:37 +00:00
Arjen Poutsma 601368d10e SPR-6291 - UrlPathHelper is too aggressive decoding URLs
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3748 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-12 12:09:43 +00:00
Juergen Hoeller 99d4de564f polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3739 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-11 20:03:40 +00:00
Juergen Hoeller c6a068f83d avoid double flushing of ObjectOutputStream when close is being called right afterwards anyway
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3738 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-11 20:00:45 +00:00
Juergen Hoeller 1a3d05d990 fixed JodaTimeContextHolder to use a non-inheritable ThreadLocal and expose a reset method (SPR-7441); use of remove() even when being called with a null argument
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3736 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-11 18:55:21 +00:00
Juergen Hoeller 219fc737fe consistent handling of handler methods, init binder methods and model attribute methods (SPR-7355)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3730 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-10 21:01:04 +00:00
Arjen Poutsma 857cd27a14 Polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3713 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-06 12:05:11 +00:00
Arjen Poutsma 4b3b5ccaac SPR-7591 - HttpStatusCodeException should contain response body
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3692 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-24 10:06:52 +00:00
Juergen Hoeller d09f1d4694 UriTemplate is serializable now (SPR-7541)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3683 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-14 05:37:30 +00:00
Juergen Hoeller 9e04940e1c fixed @MVC processing of parameter-level annotations to work with interface-based proxies again (SPR-7483)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3658 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-08 14:45:00 +00:00
Juergen Hoeller 83e4e83e7b revised @RequestParam processing to support CSV-to-array/collection binding with ConversionService (SPR-7479)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3655 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-08 12:39:57 +00:00
Arjen Poutsma aeeb0cea73 Granting Keith's wish
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3635 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-03 08:50:45 +00:00
Juergen Hoeller da758771fa consistent use of JDK 1.5's ThreadLocal.remove() over ThreadLocal.set(null), preventing leaks (SPR-7441)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3627 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-01 17:17:25 +00:00
Juergen Hoeller e26a0ab06d JaxWsPortClientInterceptor does not fall back to annotation-specified name as portName anymore (SPR-7505)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3626 50f2f4bb-b051-0410-bef5-90022cba6387
2010-09-01 14:02:32 +00:00
Ben Hale 82e5f5f5d6 Publishing license and notice files
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3612 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-23 13:17:31 +00:00
Arjen Poutsma 750dc01862 Prepping for 3.0.5
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3611 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-19 11:04:04 +00:00
Juergen Hoeller 6e2e676581 polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3601 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-16 21:24:21 +00:00
Juergen Hoeller 4fa5d75bbb WebDataBinder and @MVC request param binding detect and introspect MultipartFile arrays as well (SPR-2784)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3595 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 23:20:55 +00:00
Juergen Hoeller 99143de03f Servlet/PortletContextResource inherit isReadable, contentLength and lastModified from AbstractFileResolvingResource
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3590 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:57:37 +00:00
Juergen Hoeller ce3326a617 CommonsMultipartResolver cleans up all multipart files in case of multiple files for same name as well (SPR-2784)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3589 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:52:54 +00:00
Juergen Hoeller e39f0704a2 WebDataBinder and @MVC request param binding detect and introspect MultipartFile arrays as well (SPR-2784)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3588 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:51:02 +00:00
Juergen Hoeller 29c3bb3152 MockMultipartHttpServletRequest pre-defines method "POST" and content type "multipart/form-data"
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3587 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:46:15 +00:00
Juergen Hoeller 93fb8760ff consistent mocks between modules
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3586 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:02:40 +00:00
Juergen Hoeller b03ec5d78a renamed UriUtilsTest to UriUtilsTests
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3585 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 22:01:33 +00:00
Juergen Hoeller ebe3a85a3e fixed accidental change to byte array loop
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3584 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 21:43:24 +00:00
Juergen Hoeller 034859d900 polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3583 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 21:26:43 +00:00
Juergen Hoeller 47759cb118 polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3582 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 21:24:35 +00:00
Juergen Hoeller 3f7c46e16d revised handler method resolution, in particular with respect to generic interfaces (SPR-7355)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3579 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-15 21:12:54 +00:00
Juergen Hoeller 0c98b55bc1 revised DispatcherServlet's last-modified handling to properly work with scoped controllers; added HEAD support to ResourceHttpRequestHandler
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3573 50f2f4bb-b051-0410-bef5-90022cba6387
2010-08-12 22:54:24 +00:00