1. 22 5月, 2015 5 次提交
    • S
      Polish · 27c435c4
      Stephane Nicoll 提交于
      27c435c4
    • S
      Make SynthetizedAnnotation public · 39b2fbbc
      Stephane Nicoll 提交于
      Enable public visibility on SynthetizedAnnotation to allow annotation
      outside its package to be proxied properly. This commit is pending a
      unit test that actually reproduces the problem.
      
      Issue: SPR-13057
      39b2fbbc
    • S
      Merge from sbrannen/SPR-11512 · 4549d76f
      Sam Brannen 提交于
      * SPR-11512:
        Support annotation attribute aliases and overrides via @AliasFor
      4549d76f
    • S
      Support annotation attribute aliases and overrides via @AliasFor · ca66e076
      Sam Brannen 提交于
      This commit introduces first-class support for aliases for annotation
      attributes. Specifically, this commit introduces a new @AliasFor
      annotation that can be used to declare a pair of aliased attributes
      within a single annotation or an alias from an attribute in a custom
      composed annotation to an attribute in a meta-annotation.
      
      To support @AliasFor within annotation instances, AnnotationUtils has
      been overhauled to "synthesize" any annotations returned by "get" and
      "find" searches. A SynthesizedAnnotation is an annotation that is
      wrapped in a JDK dynamic proxy which provides run-time support for
      @AliasFor semantics. SynthesizedAnnotationInvocationHandler is the
      actual handler behind the proxy.
      
      In addition, the contract for @AliasFor is fully validated, and an
      AnnotationConfigurationException is thrown in case invalid
      configuration is detected.
      
      For example, @ContextConfiguration from the spring-test module is now
      declared as follows:
      
          public @interface ContextConfiguration {
      
              @AliasFor(attribute = "locations")
              String[] value() default {};
      
              @AliasFor(attribute = "value")
              String[] locations() default {};
      
              // ...
          }
      
      The following annotations and their related support classes have been
      modified to use @AliasFor.
      
      - @ManagedResource
      - @ContextConfiguration
      - @ActiveProfiles
      - @TestExecutionListeners
      - @TestPropertySource
      - @Sql
      - @ControllerAdvice
      - @RequestMapping
      
      Similarly, support for AnnotationAttributes has been reworked to
      support @AliasFor as well. This allows for fine-grained control over
      exactly which attributes are overridden within an annotation hierarchy.
      In fact, it is now possible to declare an alias for the 'value'
      attribute of a meta-annotation.
      
      For example, given the revised declaration of @ContextConfiguration
      above, one can now develop a composed annotation with a custom
      attribute override as follows.
      
          @ContextConfiguration
          public @interface MyTestConfig {
      
              @AliasFor(
                 annotation = ContextConfiguration.class,
                 attribute = "locations"
              )
              String[] xmlFiles();
      
              // ...
          }
      
      Consequently, the following are functionally equivalent.
      
      - @MyTestConfig(xmlFiles = "test.xml")
      - @ContextConfiguration("test.xml")
      - @ContextConfiguration(locations = "test.xml").
      
      Issue: SPR-11512, SPR-11513
      ca66e076
    • S
      Make PropertyMatches public · a87d5f8a
      Stephane Nicoll 提交于
      Issue: SPR-13054
      a87d5f8a
  2. 21 5月, 2015 9 次提交
    • S
      Fix regression with binding and validation · 6fb31903
      Stephane Nicoll 提交于
      Previously, the binding may have to call the getter first to retrieve the
      old value of a property before actually setting it. This was guarded by
      a catch block that was accidentally removed in 3d86f15a
      
      Restore that catch block and add a test to cover it.
      
      Issue: SPR-12805
      6fb31903
    • S
      Add possible matches for field access · 2ab34373
      Stephane Nicoll 提交于
      DirectFieldAccessor now support richer NotWritablePropertyException
      content, including dedicated error message and possible matches.
      
      Issue: SPR-13053
      2ab34373
    • B
      Fix directories I/O in ResourceHttpRequestHandler · 4d5fca59
      Brian Clozel 提交于
      Prior to this commit, the `ResourceHttpRequestHandler` would not
      properly handle HTTP requests to **directories contained in JARs**.
      This would result in HTTP 500 errors, caused by `FileNotFoundException`
      or `NullPointerException`.
      
      This can be tracked to webapp ClassLoader implementations in servlet
      containers:
      * in Jetty9x, fetching a directory within a JAR as a `Resource` and
      getting its InputStream work fine, but attempting to `close()` it
      results in a NullPointerException as the underlying stream is null.
      * In Tomcat6x, one cannot fetch an InputStream for the same `Resource`
      as it throws a FileNotFoundException.
      
      This change adds more try/catch clauses and catches more Exception so as
      to result in HTTP 200 OK responses instead of server errors. While this
      is inconsistent because the same code path would result in HTTP 404 with
      existing directories on the file system, there's no other simple way to
      make those checks for resources contained in JARs.
      
      Issue: SPR-12999
      4d5fca59
    • S
      Merge BeanWrapperImpl and DirectFieldAccessor · 3d86f15a
      Stephane Nicoll 提交于
      `BeanWrapperImpl` and `DirectFieldAccessor` are two
      `ConfigurablePropertyAccessor` implementations with different features
      set.
      
      This commit harmonizes the two implementations to use a common base class
      that delegates the actual property handling to the sub-classes:
      
      * `BeanWrapperImpl`:  `PropertyDescriptor` and introspection utilities
      * `DirectFieldAccessor`: reflection on `java.lang.Field`
      
      Issues: SPR-12206 - SPR-12805
      3d86f15a
    • R
      Include only path in <spring:mvcUrl> · ad4c8795
      Rossen Stoyanchev 提交于
      Issue: SPR-13045
      ad4c8795
    • R
      Add 4.2 section to the reference · af67bd94
      Rossen Stoyanchev 提交于
      af67bd94
    • R
      Add baseUrl to DefaultUriTemplateHandler · 1ba0625c
      Rossen Stoyanchev 提交于
      Issue: SPR-13035
      1ba0625c
    • S
      Merge pull request #801 from echatman/patch-1 · 01d1e71d
      Stephane Nicoll 提交于
      * patch-1:
        Fix number parsing of @Scheduled attributes
      01d1e71d
    • E
      Fix number parsing of @Scheduled attributes · 5652f02a
      Elizabeth Chatman 提交于
      See gh-801
      5652f02a
  3. 20 5月, 2015 7 次提交
    • S
      Customize destruction callback for AutoCloseable beans · 0ed9ca09
      Stephane Nicoll 提交于
      Previously, a Bean implementing `AutoCloseable` (or `Closeable`) was
      always destroyed regardless of its bean definition. In particular, the
      documented way of disabling the destruction callback via an empty String
      did not work.
      
      AutoCloseable beans are now treated pretty much as any other bean: we
      still use the presence of the interface to optimize the check of a
      destroy method and we only auto-discover the method name to invoke if
      the inferred mode is enabled.
      
      Issue: SPR-13022
      0ed9ca09
    • J
      Polishing · 271804f1
      Juergen Hoeller 提交于
      271804f1
    • J
      Compatibility with JSR-354 final (and its new Monetary singleton) · de893ada
      Juergen Hoeller 提交于
      Includes support for currency detection with @NumberFormat.
      
      Issue: SPR-12209
      de893ada
    • J
      Class identity comparisons wherever possible · b4095c3e
      Juergen Hoeller 提交于
      Issue: SPR-12926
      b4095c3e
    • B
      Polish · 57e0c789
      Brian Clozel 提交于
      Issue: SPR-12323
      57e0c789
    • B
      Polish · c5d6cc41
      Brian Clozel 提交于
      Issue: SPR-12673
      c5d6cc41
    • B
      Add a ResourceResolver implementation for WebJars · 9e5a33c1
      Brian Clozel 提交于
      Prior to this commit, WebJars users needed to use versioned links within
      templates for WebJars resources, such as `/jquery/1.2.0/jquery.js`.
      This can be rather cumbersome when updating libraries - all references
      in templates need to be updated.
      
      One could use version-less links in templates, but needed to add a
      specific MVC Handler that uses webjars.org's webjar-locator library.
      While this approach makes maintaing templates easier, this makes HTTP
      caching strategies less optimal.
      
      This commit adds a new WebJarsResourceResolver that search for resources
      located in WebJar locations. This ResourceResolver is automatically
      registered if the "org.webjars:webjars-locator" dependency is present.
      
      Registering WebJars resource handling can be done like this:
      
      ```java
      @Override
      protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:META-INF/resources/webjars")
                .resourceChain(true)
                    .addResolver(new WebJarsResourceResolver());
      }
      ```
      
      Issue: SPR-12323
      
      polish
      9e5a33c1
  4. 19 5月, 2015 13 次提交
  5. 18 5月, 2015 6 次提交