Commit Graph

7666 Commits

Author SHA1 Message Date
Phillip Webb c9aace4da2 Skip convert to Object from TypeConverterDelegate
Update TypeConverterDelegate to bypass conversion when the target type
is Object.class. Prior to this commit converting a single element array
to an Object would result in the element being returned, rather than
the array itself.

Issue: SPR-10996
2013-10-18 17:19:41 -07:00
Phillip Webb b25e91a550 Relax JavaBean rules for SpEL property access
Relax the method search algorithm used by `ReflectivePropertyAccessor`
to include methods of the form `getXY()` for properties of the form
`xy`.

Although the JavaBean specification indicates that a property `xy`
should use the accessors `getxY()` and `setxY()`, in practice many
developers choose to have an uppercase first character. The
`ReflectivePropertyAccessor` will now consider these style methods if
the traditional conventions fail to find a match.

Issue: SPR-10716
2013-10-18 16:20:57 -07:00
Phillip Webb 59fcf5014f Increase timeout for Stomp integration tests 2013-10-18 16:19:33 -07:00
Rossen Stoyanchev d2eff4ead6 Improve GenericMessage.toString()
Restore pringing the payload first and headers second as it has been in
SI but also handle specifically the case where the body is a byte array
to minimize unnecessary "noise" that causes otherwise for STOMP msgs.
2013-10-18 15:28:59 -04:00
Rossen Stoyanchev 61d13547e1 Remove @UnsubscribeEvent
The STOMP UNSUBSCRIBE message does not have a destination header so
there is no obvious simple way to do a mapping and the need for it
is not clear yet.
2013-10-18 15:15:24 -04:00
Rossen Stoyanchev 715a11ce8c Polish AnnotationMethodMessageHandler and annotations 2013-10-18 15:10:34 -04:00
Brian Clozel fb586da673 Support @PathVariable in annotated message handling methods
Prior to this commit, @SubscribeEvent @UnsubscribeEvent and
@MessageMapping annotated message handling methods
could only match a strict message destination.

This commit adds a @PathVariable annotation and
updates the message matching/handling process, since
message handling methods can now match PathMatcher-like
destinations and get path variables injected in parameters.

Issue: SPR-10949
2013-10-18 15:10:34 -04:00
Brian Clozel efa86e80d8 Upgrade json-path to 0.9.0 version
This version fixed bugs and improved performance.
New features: "select multiple attributes" and
"Array operations and slicing improved" (a new example
has been added in tests to reflect that).

See https://github.com/jayway/JsonPath/blob/master/README

Issue: SPR-10990
2013-10-18 15:10:15 -04:00
Phillip Webb 79048e18be Allow TypeDescriptor create with null generics
Restore the ability to create a TypeDescriptor for a collection or
map where the generics may be null.

Issue: SPR-11006
2013-10-18 10:58:05 -07:00
Rossen Stoyanchev cfb66252eb Merge pull request #380 from bclozel/SPR-10222 2013-10-18 12:26:34 -04:00
Rossen Stoyanchev 4f28c77db7 Polish ControllerAdvice selectors
Issue: SPR-10222
2013-10-18 12:24:55 -04:00
Brian Clozel c4a8bf9c4d Add new features on @ControllerAdvice
Prior to this commit, @ControllerAdvice annotated beans would
assist all known Controllers, by applying @ExceptionHandler,
@InitBinder, and @ModelAttribute.

This commit updates the @ControllerAdvice annotation,
which accepts now base package names, assignableTypes,
annotations and basePackageClasses.

If attributes are set, only Controllers that match those
selectors will be assisted by the annotated class.
This commit does not change the default behavior when
no value is set, i.e. @ControllerAdvice().

Issue: SPR-10222
2013-10-18 11:35:06 -04:00
Rossen Stoyanchev be4e5d2841 Add SimpleMessageConverter 2013-10-18 11:33:59 -04:00
Rossen Stoyanchev a53233b351 Fix issue in AbstractMessagingTemplate 2013-10-17 22:23:03 -04:00
Rossen Stoyanchev 29934d7c02 Add TCP abstractions to spring-messaging
This change adds abstractions for opening and managing TCP connections
primarily for use with the STOMP broker support. As one immediate
benefit the change makes the  StompBrokerRelayMessageHandler more
easy to test.
2013-10-17 22:16:15 -04:00
Rossen Stoyanchev a172b32d4c Refactor STOMP relay session
This change consolidates TCP-related logic in the StompRelaySession. As
a result the sub-class SystemStompRelaySession now contains only logic
intrinsic to the shared system session.
2013-10-17 22:16:14 -04:00
Rossen Stoyanchev 17aea892f0 Fix issue with forwarding messaging to STOMP broker 2013-10-17 22:16:14 -04:00
Rossen Stoyanchev 4e3390ae04 Upgrade to reactor 1.0 RC1 and remove MessageChannel
This change upgrades reactor to 1.0 RC1 and also removes the
reactor-based message channel in favor of the one available from
org.projectreactor:reactor-spring.
2013-10-17 22:15:59 -04:00
Phillip Webb 57a36f3f56 Support for MultiValueMap in MapToMapConverter
Refactor TypeDescriptor to use ResolvableType in order to retain full
generic type information, in the process fixing MultiValueMap support
in MapToMapConverter.

Issue: SPR-9499
2013-10-17 13:48:02 -07:00
Phillip Webb f29092db23 Polish ResolvableType & SerializableTypeWrapper
Fix 'missing serialVersionUID' warnings, support for void.class types
and refine resolve() algorithm to support narrowed types.

Issue: SPR-10973
2013-10-17 13:48:02 -07:00
Phillip Webb f4a66a4326 Polish GroovyBeanDefinitionReader formatting
Consistent use of tabs and remove trailing whitespace.

Issue: SPR-7123
2013-10-17 13:46:32 -07:00
Juergen Hoeller bb2802208b Upgraded to JCache 0.11 for Spring Framework 4.0 RC1
Unfortunately, the JCache API changed quite a bit since 0.6. We're building against a snapshot of JCache 0.11 now, tracking its way to final after the Public Review Ballot.
2013-10-17 19:35:21 +02:00
Juergen Hoeller 8d6406bbae Groovy-based bean definitions
Formerly known as the Grails BeanBuilder, now in Spring proper. Based on https://github.com/spring-projects/spring-framework/pull/355 but heavily refactored and restructured.

Issue: SPR-7123
2013-10-17 19:24:08 +02:00
Juergen Hoeller bb8cf277fb Polishing 2013-10-17 19:23:51 +02:00
Phillip Webb 3337fd32cb Refine ResolvableType class
- Support for serialization
- Allow programmatic creation of an array from a given component type
- Allow programmatic creation with given generics
- Extract generics from Class types using Class.getTypeParameters()
- Move TypeVariableResolver to an inner class (and make method private)
- Refine 'resolve()' algorithm

Issue: SPR-10973
2013-10-16 23:45:51 -07:00
Sam Brannen 7ffd05a8e3 Document 'annotated classes' in Testing chapter
In order to help developers avoid surprises from unintended use of
"@Bean Lite Mode" when referencing classes via @ContextConfiguration in
the TestContext framework, this commit duplicates the previous
discussion of "annotated classes" from the Javadoc for
@ContextConfiguration as a tip in the "Context configuration with
annotated classes" section of the Testing chapter in the reference
manual.

Issue: SPR-10971
2013-10-16 18:10:47 +02:00
Juergen Hoeller d87838fc6d Polishing 2013-10-16 01:51:49 +02:00
Juergen Hoeller 187b681b9e Consistency between InvocableHandlerMethod in web and messaging modules 2013-10-16 01:51:48 +02:00
Juergen Hoeller c38bde259a Polishing
Issue: SPR-10185
2013-10-16 01:51:48 +02:00
Juergen Hoeller 9bfbe36b1c Restored registration of nested component classes (even without factory methods)
Issue: SPR-10865
Issue: SPR-10970
2013-10-16 01:51:47 +02:00
Rossen Stoyanchev 190bf247a3 Add helper method to ResourceHandlerRegistry 2013-10-15 09:49:54 -04:00
Sam Brannen 079bebcfb5 Delete unused import in StdReflParamNameDscoverer 2013-10-15 15:24:25 +02:00
Sam Brannen 8fdc7d4e8f Polish type prediction for generic factory methods
- Now avoiding NullPointerExceptions in GenericTypeResolver's
   resolveReturnTypeForGenericMethod() in case the supplied ClassLoader
   is null.
 - AutowireUtils.resolveReturnTypeForFactoryMethod() now properly
   asserts that the supplied ClassLoader is not null.
 - Fixed copy-n-paste errors in Javadoc for
   AutowireUtils.resolveReturnTypeForFactoryMethod().

Issue: SPR-10411
2013-10-15 15:21:47 +02:00
Sam Brannen e86e182d5d Reinstate deleted @author tag
SPR-10411
2013-10-15 15:09:05 +02:00
Rossen Stoyanchev bcfbd862c7 Add value() attribute to @Payload 2013-10-14 22:16:13 -04:00
Rossen Stoyanchev 70dfec269b Use alternative UUID strategy in MessageHeaders
This change adds an alternative UUID generation strategy to use by
default in MessageHeaders. Instead of using SecureRandom for each
new UUID, SecureRandom is used only for the initial seed to be
provided java.util.Random. Thereafter the same Random instance is
used instead. This provides improved performance while id's are
still random but less securely so.
2013-10-14 21:55:13 -04:00
Rossen Stoyanchev 57d127b55a Validate if STOMP frame is allowed to have a body
Issue: SPR-10890
2013-10-14 21:37:44 -04:00
Rossen Stoyanchev 7c3749769a Add STOMP broker relay to configure "host" header
Issue: SPR-10955
2013-10-14 21:06:53 -04:00
Rossen Stoyanchev cf7889e226 Fix issue with DeferredResult on @RestController
Before this change, async result handling on controller methods failed
to observe type-level annotations annotations. The issue was never
noticed until we started supporting type-level @ResponseBody and the
@RestController meta annotation.

Issue: SPR-10905
2013-10-14 21:06:53 -04:00
Juergen Hoeller 3bd6dfe047 Autowiring of generic types
Includes revisions of MethodParameter and DependencyDescriptor (in particular towards a reference to the containing class). Also refines several ResolvableType method signatures.

Issue: SPR-9965
2013-10-15 00:11:23 +02:00
Juergen Hoeller 74794190a5 Implement java.io.Flushable wherever applicable 2013-10-14 23:52:31 +02:00
Juergen Hoeller 8b1927f3ec Fixed type prediction for generic factory methods
We're consistently resolving class names now, and the entire algorithm moved from GenericTypeResolver to the internal AutowireUtils helper in the bean factory package.

Issue: SPR-10411
2013-10-14 23:50:04 +02:00
Juergen Hoeller 41f041e6ae Reduced "getParameterType call not supported" log message to single line
Issue: SPR-10185
2013-10-14 23:31:53 +02:00
Juergen Hoeller 7a9d58375f Changed JSR-330 detection logging from info to debug
Issue: SPR-10974
2013-10-14 23:24:25 +02:00
Sam Brannen 977c8c7137 Polish Javadoc for ResolvableType 2013-10-14 17:57:16 +02:00
Brian Clozel 5de5198005 Allow greater flexibility for template method createDataBinderFactory
Prior to this commit, the template method createDataBinderFactory
would only allow ServletRequestDataBinderFactory as a return type.

This commit updates the method signature and allows
InitBinderDataBinderFactory, a superclass of the previous one.
Then other implementations can override this method and return
other InitBinderDataBinderFactory types.

Issue: SPR-10920
2013-10-14 10:21:09 +02:00
Rossen Stoyanchev 8ae88c20d1 Add support for resolving message headers
This change adds support for @Header and @Headers annotated method
arguments to spring-messaging. Also supported are arguments of type
MessageHeaders, and MessageHeaderAccessor (including sub-types of
MessageHeaderAccessort as long as they provide a wrap(Message<?>)
static factory method).

This change also renames @MessageBody to @Payload.

Issue: SPR-10985
2013-10-13 11:13:16 -04:00
Phillip Webb ca9df4d2ef Return rather than throw converted http exception
Fix HttpInvokerClientInterceptor.convertHttpInvokerAccessException to
return the translated exception rather than throwing it. This brings
the method implementation in line with the Java Doc and the obvious
original intent.

Issue: SPR-10965
2013-10-11 14:47:58 -07:00
Phillip Webb 2c6282055c Merge pull request #315 from garyrussell/SPR-10501
* SPR-10501:
  Add Reference to Spring AMQP Remoting in docs
2013-10-11 09:34:59 -07:00
Gary Russell 0e7769b5bb Add Reference to Spring AMQP Remoting in docs
Beginning with 1.2.0, Spring AMQP now supports remoting over AMQP with
a proxy factory bean an invoker service exporter.

Add documentation to the Spring Framework remoting section with a link
to the Spring AMQP documentation.

Issue: SPR-10501
2013-10-11 09:33:09 -07:00