Commit Graph

298 Commits

Author SHA1 Message Date
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Juergen Hoeller fe05e7e5b3 Self reference detection defensively handles null bean names
Issue: SPR-12018
2014-07-24 12:56:10 +02:00
Juergen Hoeller 496492b2d8 Autowiring rejects self references to a factory method on the same bean as well
Issue: SPR-12018
2014-07-24 12:13:25 +02:00
Stephane Nicoll e849bc3e90 Fix potential NPE
This commit fixes a potential NPE when determining the priority of a
bean instance in case multiple candidates exist and no bean was marked
as @Primary

Issue: SPR-12024
2014-07-23 18:51:09 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 2665d56209 Polishing 2014-07-15 15:13:35 +02:00
Juergen Hoeller a4968b9015 DefaultListableBeanFactory's registerBeanDefinition only calls resetBeanDefinition in case of pre-existing bean definition or pre-existing singleton instance
Issue: SPR-8318
2014-07-15 15:05:13 +02:00
Stephane Nicoll b676c41805 Add missing 4.1 XSDs
This commit adds the missing 4.1 XSDs for the following components:

* spring-aop
* spring-context
* spring-jee
* spring-lang
* spring-tx
* spring-util

These are strictly identical to the definition of the 4.0 XSDs.

Issue: SPR-11990
2014-07-14 17:59:54 +02:00
Juergen Hoeller 2bd6e24b65 MBeanExporter implements newly introduced SmartInitializingSingleton callback interface
Issue: SPR-8045
2014-07-10 15:48:36 +02:00
Juergen Hoeller a6a86b8025 DefaultBeanDefinitionDocumentReader evaluates profile attribute only in beans namespace
Issue: SPR-11975
2014-07-09 21:17:43 +02:00
Stephane Nicoll b78b2e9a03 Fix priority semantic
Commit 5fe8f52 introduced a support for @Priority as an alternative to
@Primary but it broke the semantic of the priority value. This commit
fixes this inconsistency.

As for @Order, the lowest value means the highest priority so if
several beans are candidates for injection, the one having the lowest
value will be used.

Issue: SPR-10548
2014-07-08 10:26:03 +02:00
Juergen Hoeller 01264dc673 Polishing 2014-07-08 00:59:31 +02:00
Juergen Hoeller 6c41cc354c ConstructorResolver's exception message on null factory-bean hints at potential BeanPostProcessor involvement
Issue: SPR-11951
2014-07-04 22:30:19 +02:00
Juergen Hoeller 87cbade8be Test variant for SPR-11521 (currently @Ignored)
Issue: SPR-11521
2014-07-02 15:13:34 +02:00
Juergen Hoeller d870b382da Defensively check for pre-resolved FactoryBean.getObject() results in circular reference scenarios
Issue: SPR-11937
2014-07-01 23:50:17 +02:00
Juergen Hoeller b7984f21d8 Polishing 2014-07-01 20:30:31 +02:00
Juergen Hoeller f8b6114440 BeanFactoryAnnotationUtils consistently applies bean name fallback when no BeanDefinition present
Issue: SPR-11915
2014-07-01 16:29:40 +02:00
Juergen Hoeller 974bd43f28 AbstractAutowireCapableBeanFactory's createBean/autowireBean/configureBean use CacheUtils.isCacheSafe to re-enable PropertyDescriptor caching
Issue: SPR-11875
2014-06-30 00:58:44 +02:00
Juergen Hoeller fab67b0595 CachedIntrospectionResults and co consistently avoid synchronization (through use of ConcurrentReferenceHashMap)
As a side effect, through ConcurrentReferenceHashMap, we're using soft references for non-cache-safe bean classes.

Issue: SPR-11867
2014-06-30 00:16:15 +02:00
Stephane Nicoll 8221c9abc5 Support for nested path using field access
This commit adds a nested path support for DirectFieldAccessor that is
similar to what BeanWrapper provides. It is now possible to use
expressions such as "person.address.city.name" to access the name of
the city that a given person lives in using fields to traverse the
graph.

DirectFieldAccessor also now supports an auto-grow option to create
a default instance for a "null" intermediate path. This option is
false by default and leads to a NullValueInNestedPathException in such
a case.

This commit also harmonizes part of the tests suite so that core tests
are shared between BeanWrapperImpl and DirectFieldAccessor.

Note that map and list access is not implemented as part of this
commit.

Issue: SPR-9705
2014-06-26 19:22:02 +02:00
Juergen Hoeller d6635802c4 TypeDescriptor's nested type traversal leniently returns null in case of unresolvable nested type
Issue: SPR-11898
2014-06-24 20:57:09 +02:00
Juergen Hoeller bc1f19ce18 Defensively check javaUtilOptionalEmpty
Issue: SPR-11888
2014-06-19 21:14:43 +02:00
Rossen Stoyanchev 0dc6082b01 Support java.util.Optional for @MVC named value args
After this change, java.util.Optional is supported with @RequestParam,
@RequestHeader, and @MatrixVariable arguments in Java 8. When Optional
is used the required flag is effectively ignored.

Issue: SPR-11829
2014-06-16 14:16:56 -04:00
Juergen Hoeller ea346d59b3 Polishing 2014-06-07 00:25:06 +02:00
Juergen Hoeller 85b2c7d116 AbstractAutowireCapableBeanFactory's getTypeForFactoryBean considers FactoryBean<Object> declarations as non-indicative (just like raw declarations)
Issue: SPR-11842
2014-06-06 18:43:29 +02:00
Juergen Hoeller 5cb3f8eada Support for java.util.Optional within ObjectFactory/Provider
Includes support for arbitrary deep nesting levels in DependencyDescriptor's getDependencyType() and MethodParameter's getNestedParameterType().

Issue: SPR-11833
2014-06-06 15:29:50 +02:00
Juergen Hoeller 7d03daf8cb Support for Java 8's java.util.Optional at injection points
Issue: SPR-11833
2014-06-06 14:41:01 +02:00
Juergen Hoeller f7b465390c Moved @Uses annotations to org.springframework.lang; fixed Base64Utils to declare Java 8, and fixed PathResource's declaration to refer to Java 7.
Issue: SPR-11604
2014-06-04 21:34:23 +02:00
Alex Yursha 8b8afe3def Fix a typo 2014-06-04 21:16:17 +02:00
Stephane Nicoll 001d0e734c Support for @Order at the bean declaration level
This commit introduces OrderProvider and OrderProviderComparator, two
interfaces designed to externalize how a collection of element is sorted
according to their order value.

FactoryAwareOrderProvider is an OrderProvider implementation that knows
about the objects to order and the corresponding BeanFactory instance.
This allows to retrieve additional metadata about the actual instances
to sort, such as its factory method.

A @Bean method can now holds an additional @Order to define the order
value that this bean should have when injected as part of a collection
or array.

Issue: SPR-11310
2014-06-04 21:04:13 +02:00
Juergen Hoeller 551950cdc0 Consistent use of ClassUtils.forName instead of class.getClassLoader().loadClass
Issue: SPR-11780
2014-05-15 09:56:11 +02:00
Juergen Hoeller 6c1f8de5fa Eventual removal of deprecated AbstractBeanConfigurerAspect, BeanReferenceFactoryBean and CommonsLogFactoryBean 2014-05-08 16:24:22 +02:00
Stephane Nicoll 580e52372f Add support of YAML
This commit migrates the YAML support available in Spring Boot to
the core framework. YAML documents can be loaded either as a
properties object or as a map.

Issue: SPR-9897
2014-05-08 12:02:20 +02:00
Juergen Hoeller a653c06711 Fixed invalid code tag in javadoc
(cherry picked from commit a139670)
2014-05-01 00:53:10 +02:00
Stephane Nicoll bd85c916eb Integrate animal sniffer
Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
2014-04-30 13:51:01 +02:00
Juergen Hoeller 0ef29b204b GenericBeanDefinition's toString() takes parent definition into account
Issue: SPR-9671
2014-04-28 13:59:51 +02:00
Juergen Hoeller 6cb45f714e General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
(cherry picked from commit 59cef3c)
2014-04-28 00:47:21 +02:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Juergen Hoeller 14f9dbf70c Consistent documentation for both 'close' and 'shutdown' as inferred destroy methods
Issue: SPR-11680
2014-04-10 22:52:22 +02:00
Juergen Hoeller 8ed490c4d7 Polishing 2014-04-02 20:57:28 +02:00
Stephane Nicoll db23ec733b Add exception handling of asynchronous method
Prior to this commit, an exception thrown by an @Async void method
was not further processed as there is no way to transmit that
exception to the caller.

The AsyncUncaughtExceptionHandler is a new strategy interface that
can be implemented to handle unexpected exception thrown during the
invocation of such asynchronous method.

The handler can be specified using either the XML namespace or by
implementing the AsyncConfigurer interface with the EnableAsync
annotation.

Issue: SPR-8995
2014-04-02 15:04:40 +02:00
Stephane Nicoll dcf5f4a6a3 javax.annotation.Priority alternative to @Order
This commit rationalizes the use of @Order so that the standard
@Priority annotation can be used instead. The handling of both
annotations are now defined in OrderUtils.

This also updates the link to the JavaEE API so that we refer to
JavaEE7 instead of JavaEE6.

Issue: SPR-11639
2014-04-01 14:30:47 +02:00
Stephane Nicoll 5fe8f52c02 Add support for @Priority
This commit adds support for @Priority to filter multiple candidates
for autowiring. When multiple candidates are available for a given
bean, the bean annotated with @Primary is used. If none exists, the
one with the higher value for the @Priority annotation is used. If
two beans have the same priority a NoUniqueBeanDefinitionException
is thrown, just as if two beans are annotated with @Primary.

The underlying code for #getBean and #resolveDependency has been
merged as this feature is available for both dependency injection
and bean lookup by type.

Issue: SPR-10548
2014-03-31 15:49:10 +02:00
Stephane Nicoll 48221798f5 Improving test coverage of determinePrimaryCandidate
Added tests checking the behaviour of autowiring by type when the @Primary
annotation is present on the class. Fixed also some inconsistencies in the
code.
2014-03-31 15:37:55 +02:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller cf290ab42a Extracted simple MethodInvokingBean as alternative to (and base class for) MethodInvokingFactoryBean
Issue: SPR-11196
2014-03-17 15:13:59 +01:00
Juergen Hoeller 5308b3e358 Revised naming for prototype inner beans to avoid excessive unique name calculation
Restored original singleton-only adaptInnerBeanName behavior, avoiding endless unique name calculation for every single prototype instance. Non-named inner BeanDefinition objects now suffixed with an identity hex code analogous to non-named XML bean definitions, largely avoiding naming collisions to begin with. After SPR-11246, post-processors can deal with unstable classes per bean name, so occasional collisions aren't a hard problem anymore.

Issue: SPR-11545
2014-03-14 20:38:09 +01:00
Sam Brannen b364599278 Update links to Spring JIRA server 2014-03-10 12:26:29 +01:00
Juergen Hoeller 3dfa7e9ac0 Avoid stack overflow in case of circular type reference
Issue: SPR-11522
2014-03-07 00:08:15 +01:00
Juergen Hoeller 93c8b7ab04 DefaultListableBeanFactory only puts 'cache-safe' Class keys into its by-type cache
Issue: SPR-11520
2014-03-06 22:41:38 +01:00