Compare commits

..

155 Commits

Author SHA1 Message Date
Chris Beams 4f9593da1c Fix typo in reference documentation
Issue: SPR-9321
2012-04-13 20:39:35 +03:00
Chris Beams aac21fdcec Update reference doc copyright year to 2012 2012-04-13 20:35:05 +03:00
Chris Beams dfd75352d3 Ignore spring-build 'docbook' directory 2011-12-22 22:23:45 +01:00
Chris Beams 6316448453 Increment version to 3.0.8.BUILD-SNAPSHOT 2011-12-22 22:23:45 +01:00
Chris Beams 40015e3de3 Release Spring Framework 3.0.7.RELEASE 2011-12-22 22:23:34 +01:00
Chris Beams 5e448af903 Update doc publication urls to static.s2.org 2011-12-22 22:17:56 +01:00
Chris Beams 1f3ce640c9 Add source directories to quell Eclipse errors 2011-12-22 18:15:18 +01:00
Juergen Hoeller cca44f411e added test for correct handling of ParseException from Formatter for String->String case (SPR-8944) 2011-12-22 15:19:59 +01:00
Juergen Hoeller 9b0412f35f fixed NamedParameterJdbcTemplate to use correct maximum type for queryForInt/Long (SPR-8652) 2011-12-22 13:12:22 +01:00
Juergen Hoeller 7eee3b9926 extended test time limits (in order o make the 3.0.x CI build plan happy) 2011-12-22 13:00:15 +01:00
Juergen Hoeller b5a279d2c8 final preparations for 3.0.7 2011-12-22 03:05:56 +01:00
Juergen Hoeller 0862a29066 "file-encoding" attribute value is being applied correctly (SPR-8024) 2011-12-22 03:05:40 +01:00
Juergen Hoeller 8d83f6966e Hibernate synchronization properly unbinds Session even in case of afterCompletion exception (SPR-8757) 2011-12-22 02:58:25 +01:00
Juergen Hoeller ce5117c9ed prepared for 3.0.7 release 2011-12-22 02:29:12 +01:00
Juergen Hoeller 836e3c9253 refined collection element conversion (SPR-8674) 2011-12-22 02:14:55 +01:00
Juergen Hoeller 2006eecb18 IntelliJ IDEA 11 project setup 2011-12-21 22:36:45 +01:00
Chris Beams 91287828f7 Preserve empty src/main/java dirs for ant build
Following the move to git, empty dirs are not tracked. Add .gitignore
files as necessary to keep the ant build happy.
2011-12-19 17:07:40 +01:00
Chris Beams efd2fc7688 Increment version to 3.0.7.BUILD-SNAPSHOT 2011-12-19 15:35:48 +01:00
Juergen Hoeller 74b5487a28 IntelliJ IDEA 11 project setup 2011-12-19 15:35:48 +01:00
Chris Beams 2882ae29b2 Add spring-build 2.5.2
spring-build was previously included via an svn:external. Adding
directly to the source tree under Git to avoid the need for a git
submodule.

In order to build from any earlier commit, it is recommended to
export spring-build or symlink an existing copy into the root
of the spring-framework project and then build normally.

    $ svn export https://src.springsource.org/svn/spring-build/tags/project-build-2.5.2 spring-build
2011-12-19 15:35:48 +01:00
Juergen Hoeller 4a7b96c4ca take element/key/value objects into account for the best possible type descriptor 2011-12-12 00:44:38 +00:00
Juergen Hoeller 7398e0ea97 polishing 2011-12-11 23:07:27 +00:00
Juergen Hoeller beaad20795 DataBinder etc 2011-12-11 22:11:50 +00:00
Juergen Hoeller 1bd84db56e polishing (alignment with 3.1 GA) 2011-12-11 22:06:59 +00:00
Juergen Hoeller 6316a45927 backported fix for SPR-8697 from 3.1 RC2 2011-12-11 22:06:28 +00:00
Juergen Hoeller e298c202af @Transactional qualifiers match against transaction manager definitions in parent contexts as well (SPR-7679) 2011-12-11 13:27:08 +00:00
Juergen Hoeller 288408e89f fixed assertion message 2011-12-09 16:01:30 +00:00
Juergen Hoeller 53a244d408 JmsInvokerClientInterceptor/FactoryBean always uses createConnection/createSession when on JMS 1.1 2011-12-09 12:07:45 +00:00
Juergen Hoeller 8213d0cb50 restored DataBinder's ability to bind to an auto-growing List with unknown element type (SPR-8828) 2011-12-07 21:25:54 +00:00
Juergen Hoeller b9868a498e ConversionService etc 2011-12-07 00:02:16 +00:00
Juergen Hoeller df7bdfa7c6 polishing 2011-12-06 22:50:48 +00:00
Juergen Hoeller f8402e9f82 ResourceHttpRequestHandler sends content without content-type header if no media type found (SPR-7713) 2011-12-06 22:50:33 +00:00
Juergen Hoeller 7eeb654eec ConversionService is able to work with "Collections.emptyList()" as target type (again; SPR-7293) 2011-12-06 21:18:13 +00:00
Juergen Hoeller b558c62953 polishing 2011-12-05 21:21:32 +00:00
Juergen Hoeller d64dd1943f consistent specification of standard meta-annotations 2011-12-03 15:47:29 +00:00
Juergen Hoeller bffa50e31a Portlet session mutex uses global session attribute to be shared among all portlets in the session (SPR-8888) 2011-12-02 12:03:43 +00:00
Juergen Hoeller 143cb50986 ConversionService prevents Converter from trying to convert to a subtype of its actual target type (SPR-8718) 2011-12-02 11:18:31 +00:00
Juergen Hoeller b3ccc438af conversion fixes etc 2011-12-01 18:50:11 +00:00
Juergen Hoeller 94513c1a28 fixed nested element conversion with a DataBinder + ConversionService + PropertyEditor (SPR-8674) 2011-12-01 18:49:53 +00:00
Juergen Hoeller c9607fdaf2 CollectionCollection/MapToMapConverter preserve original Collection/Map if no converted elements (SPR-8714) 2011-12-01 17:49:43 +00:00
Juergen Hoeller 7c108c1e77 updated H2 error codes in sql-error-codes.xml (SPR-8235, SPR-7480) 2011-12-01 14:07:04 +00:00
Juergen Hoeller 77372d7cdb fixed NamedParameterJdbcTemplate to use correct maximum type for queryForInt/Long (SPR-8652) 2011-12-01 13:59:24 +00:00
Juergen Hoeller 173f307ec9 backported header matching fix for correct processing of negated header conditions (SPR-8862) 2011-12-01 13:52:47 +00:00
Juergen Hoeller 2c987b0ffb backported DefaultResponseErrorHandler IOException fix (SPR-8713) 2011-12-01 13:33:51 +00:00
Juergen Hoeller 46a4ac9628 fixed ServletServerHttpRequest to reconstruct from "request.getParameterMap()" for form POST only (SPR-8688) 2011-12-01 13:27:25 +00:00
Juergen Hoeller c2997f4dd9 backported Java 6 visibility bridge method pair (SPR-8660) 2011-12-01 13:12:59 +00:00
Juergen Hoeller 0150000d8b backported TaskExecutorAdapter fix (SPR-8772) 2011-12-01 13:04:55 +00:00
Juergen Hoeller cad5eb836c allow for JDO 3.0 as well (SPR-8655) 2011-12-01 12:59:53 +00:00
Juergen Hoeller c82dab6497 backported public signatures in GenericTypeResolver (SPR-8005) 2011-12-01 12:52:33 +00:00
Juergen Hoeller e6f4e16219 backports from 3.1 RC2 2011-11-28 22:58:06 +00:00
Juergen Hoeller d0032f43c7 AbstractCachingViewResolver allows for caching unresolved view names ("cacheUnresolved"=true; SPR-8524) 2011-11-28 22:35:48 +00:00
Juergen Hoeller 8a43dd172c fixed getAsText javadoc (SPR-7890) 2011-11-28 21:14:47 +00:00
Juergen Hoeller 11aaefffbf refined Resource "exists()" check for HTTP URLs to always return false for 404 status (SPR-7881) 2011-11-28 21:12:08 +00:00
Juergen Hoeller c6b36cc207 JPA EntityManagerFactoryUtils silently ignores IllegalArgumentExceptions from setHint calls (SPR-7947) 2011-11-28 20:54:44 +00:00
Juergen Hoeller 5856db6f72 LinkedCaseInsensitiveMap overrides putAll method as well (for IBM JDK 1.6 compatibility; SPR-7969) 2011-11-28 20:48:10 +00:00
Juergen Hoeller 3c5e02a54a JDO PersistenceManager synchronization performs close attempt after completion (if necessary; SPR-8846) 2011-11-28 19:38:38 +00:00
Juergen Hoeller db0c921313 TransactionSynchronizationManager eagerly cleans up void ResourceHolders on any access (SPR-8844, SPR-8845) 2011-11-28 18:54:20 +00:00
Juergen Hoeller 641bc35a50 fixed setRootObject check in StandardEvaluationContext (SPR-8241) 2011-11-28 17:34:57 +00:00
Juergen Hoeller c166803d41 added "forwarder" property to ConnectorServerFactoryBean, accepting an MBeanServerForwarder (SPR-8820) 2011-11-28 17:17:56 +00:00
Juergen Hoeller 12e1784a99 Servlet/PortletContextResource's getFile prefers "file:" URL resolution over calling getRealPath (SPR-8461) 2011-11-28 16:51:52 +00:00
Juergen Hoeller bfabd58106 fixed "formMultiSelect"/"formCheckboxes" FreeMarker macros to compare against actual field value (SPR-7721) 2011-11-28 14:42:10 +00:00
Juergen Hoeller 540845e613 added getObjectMapper() accessor to MappingJacksonHttpMessageConverter (SPR-8605) 2011-11-28 14:35:08 +00:00
Juergen Hoeller 8e7982397c SimpleJdbcTestUtils executeSqlScript properly closes its LineNumberReader after use (SPR-8872) 2011-11-28 13:33:13 +00:00
Juergen Hoeller 84890ebc0d prepared for 3.0.7 2011-10-20 12:11:36 +00:00
Juergen Hoeller a9f28575b1 optimized DefaultListableBeanFactory's PropertyDescriptor caching for concurrent access (SPR-7863) 2011-10-20 12:06:40 +00:00
Juergen Hoeller a730bf47df LocaleEditor and StringToLocaleConverter do not restrict variant part through validation (SPR-8637) 2011-10-20 11:54:52 +00:00
Juergen Hoeller b5ec65cef6 fixed GenericTypeResolver to consistently return null if not resolvable (SPR-8698) 2011-10-20 11:21:39 +00:00
Juergen Hoeller 965c12b0f8 RmiClientInterceptor detects nested SocketException as connect failure as well (SPR-8628) 2011-10-20 11:10:23 +00:00
Juergen Hoeller 7187029ef6 added proper "contentLength()" implementation to ByteArrayResource (SPR-8709) 2011-10-20 11:03:41 +00:00
Juergen Hoeller 6363bb4b5b fixed Hibernate Validator import range 2011-08-18 23:15:16 +00:00
Juergen Hoeller 58ea5a702d backported autogrow fix: converted Collection differs from original Collection 2011-08-18 20:31:27 +00:00
Chris Beams 97b988ade8 Update pom versions to 3.0.6.BUILD-SNAPSHOT 2011-08-18 19:34:46 +00:00
Chris Beams 227234288f Backport rename JMX tests to avoid jmxremote_optional error
Issue: SPR-8089, SPR-8093, SPR-8458
2011-08-18 19:33:55 +00:00
Juergen Hoeller 05a7b65d43 backported NotificationListenerTests fixes 2011-08-18 19:05:31 +00:00
Juergen Hoeller cee6cb859d added test for month sequence (SPR-7807) 2011-08-17 21:01:39 +00:00
Juergen Hoeller 19c6a4e209 RequiredAnnotationBeanPostProcessor's skip attribute accepts "true" as String value as well (SPR-8617) 2011-08-16 22:41:45 +00:00
Juergen Hoeller b9089a8f9d final preparations for 3.0.6 2011-08-15 21:31:25 +00:00
Juergen Hoeller 7a20ed7d70 fixed timeout assertion 2011-08-15 21:29:15 +00:00
Juergen Hoeller 99588950d2 polishing 2011-08-15 21:24:41 +00:00
Juergen Hoeller a2129a132f consistent "connectTimeout" and "readTimeout" properties (SPR-8615) 2011-08-15 20:57:14 +00:00
Rossen Stoyanchev 0f1c10bc1c SPR-8612 Allow use of explicit status code in HTTP 1.0 compatibility mode 2011-08-15 13:02:48 +00:00
Juergen Hoeller 585745de32 added "connectTimeout" and "readTimeout" properties to SimpleClientHttpRequestFactory (SPR-8614) 2011-08-12 22:59:14 +00:00
Juergen Hoeller 65077d262c overridden @PersistenceContext annotations on subclass methods are being processed correctly (SPR-8594) 2011-08-12 13:54:44 +00:00
Juergen Hoeller da36c2b8b8 polishing 2011-08-12 10:03:28 +00:00
Juergen Hoeller 8f01770f29 backported "formatters" property to FormattingConversionServiceFactoryBean 2011-08-12 10:03:12 +00:00
Juergen Hoeller c51b9a7be2 removed GenericConversionService logging in order to avoid toString side effects (and to avoid isTraceEnabled overhead; SPR-8297) 2011-08-04 17:23:50 +00:00
Juergen Hoeller 3ffc0a2da2 SpringBeanAutowiringSupport is able to process @Value annotations on any given target instance (SPR-8574) 2011-08-03 10:20:04 +00:00
Juergen Hoeller acac25b2eb polishing 2011-08-02 19:19:22 +00:00
Juergen Hoeller cb0c0c503f ContentNegotiatingViewResolver properly handles invalid accept headers (SPR-7712) 2011-08-02 19:15:06 +00:00
Juergen Hoeller 215ccc2e10 final preparations for 3.0.6 2011-07-28 20:45:14 +00:00
Juergen Hoeller d95cbe23ee added support for web.xml context-param "springJspExpressionSupport" (explicit "true"/"false") 2011-07-28 20:26:07 +00:00
Juergen Hoeller ac1ffff9db general polishing (backported from 3.1) 2011-07-28 14:27:08 +00:00
Juergen Hoeller c0257aba9b accepts description subelement within map entry as well (as per the XSD; SPR-8563) 2011-07-28 11:14:26 +00:00
Juergen Hoeller 79aa661dd6 DefaultListableBeanFactory allows for init methods to register further bean definitions (again; SPR-7757) 2011-07-27 22:52:00 +00:00
Juergen Hoeller 18540debf6 backported locking enhancements for @MVC processing (SPR-7703) 2011-07-27 22:38:32 +00:00
Juergen Hoeller 7605707c18 backported @PathVariable matching fix (SPR-8543) 2011-07-27 22:31:17 +00:00
Juergen Hoeller d48c3b5d4f HtmlUtils properly escapes single quotes as well 2011-07-27 21:22:39 +00:00
Juergen Hoeller b122cf87df HtmlUtils properly escapes single quotes as well 2011-07-27 20:36:14 +00:00
Juergen Hoeller 183523d045 updated ResourceHttpRequestHandlerTests 2011-07-26 09:23:57 +00:00
Juergen Hoeller a4f62bb863 moved OpenSessionInViewTests back to orm module 2011-07-26 01:12:01 +00:00
Juergen Hoeller 80def4b695 copy css and js resources as well 2011-07-26 01:08:46 +00:00
Juergen Hoeller 42e18e6c4e fixed OpenEntityManagerInViewTests through the addition of a local copy of our Servlet API mocks; restoredOpenPersistenceManagerInViewTests 2011-07-26 00:52:15 +00:00
Juergen Hoeller d8767774c9 replaced TypeDescriptor synchronization with volatile variables (SPR-8559) 2011-07-25 16:31:46 +00:00
Juergen Hoeller f67e726be7 restored OpenEntityManagerInViewTests 2011-07-25 12:15:47 +00:00
Juergen Hoeller 41b9a461df ResourceHttpRequestHandler detects invalid directory traversal in given path (SPR-8515) 2011-07-25 10:57:39 +00:00
Juergen Hoeller 037497cb4f fixed ignored test 2011-07-21 10:35:05 +00:00
Juergen Hoeller 3ecb6b1a03 refined JBoss 6.0 note 2011-07-21 09:51:34 +00:00
Juergen Hoeller 6b92f66ebd final preparations for 3.0.6 release 2011-07-21 09:09:54 +00:00
Juergen Hoeller 070a723ef2 added "acceptProxyClasses" flag to RemoteInvocationSerializingExporter 2011-07-21 09:05:59 +00:00
Juergen Hoeller d4be29e661 updated javadoc for server-specific LoadTimeWeavers 2011-07-21 08:37:42 +00:00
Juergen Hoeller 3a3f15f144 improved ExposeInvocationInterceptor error message with respect to advice ordering (SPR-8544) 2011-07-21 07:39:11 +00:00
Juergen Hoeller 3edf8566ed fixed @ExceptionHandler exception type matching (ExceptionDepthComparator; SPR-8231) 2011-07-21 07:38:30 +00:00
Juergen Hoeller a2f00f205a collection/array conversion returns original collection if possible (SPR-8538); backported smarter element conversion check from 3.1 2011-07-20 19:57:40 +00:00
Juergen Hoeller 340a8b28f9 ConvertiblePair implements equals and hashCode (SPR-8459) 2011-07-19 15:54:36 +00:00
Juergen Hoeller 83c5753ae1 updated dependencies 2011-07-18 21:46:08 +00:00
Juergen Hoeller 67bb044a6f fixed whitespace 2011-07-18 21:33:45 +00:00
Juergen Hoeller 9ddfb375cb polishing 2011-07-18 20:49:58 +00:00
Juergen Hoeller 6fc6a9e80c fixed @Rule execution order in SpringJUnit4ClassRunner to match standard JUnit 4 behavior (SPR-8537) 2011-07-18 20:49:26 +00:00
Juergen Hoeller f18fa08aa0 ConfigurationClassPostProcessor supports use of same processor instance with several factories (SPR-8527) 2011-07-18 20:45:02 +00:00
Juergen Hoeller aa4ecdb79e fixed AccessControlContext applicability check 2011-07-15 14:43:33 +00:00
Juergen Hoeller 8041f6abdd polishing 2011-07-13 23:03:50 +00:00
Juergen Hoeller 210c77ddb0 SimpleClientHttpRequest uses fixed-length streaming mode (always sets content-length header); partial backport from 3.1 M2 2011-07-13 23:03:35 +00:00
Juergen Hoeller 24cb345b6c backported HttpHeadersTests update 2011-07-13 23:02:08 +00:00
Juergen Hoeller 0fdd7550b8 an EntityManagerFactoryBean is only deserializable through a SerializedEntityManagerFactoryBeanReference 2011-07-11 13:50:59 +00:00
Juergen Hoeller f1fb0e5330 prototype-based TargetSource is only deserializable through a SingletonTargetSource 2011-07-11 13:38:45 +00:00
Juergen Hoeller d4c2f63160 fixed package declaration 2011-07-04 22:05:21 +00:00
Juergen Hoeller b167f3f7a6 added JBoss dependency (SPR-8505); updated WebSphere dependency 2011-07-04 21:38:25 +00:00
Juergen Hoeller 63fe7bdd34 switched from readResolve to readObject 2011-07-04 21:21:56 +00:00
Juergen Hoeller 270db64243 optimized debug logging in case of non-convertible collection (SPR-8499) 2011-07-04 09:59:58 +00:00
Juergen Hoeller 15fd972417 DataBinder etc 2011-07-03 22:38:48 +00:00
Juergen Hoeller 10d9860457 ContextLoader and FrameworkServlet support "contextId" parameter for custom serialization id 2011-07-03 22:38:11 +00:00
Juergen Hoeller 01eab03dca added "autoGrowNestedPaths" property to ConfigurableWebBindingInitializer 2011-07-03 21:25:05 +00:00
Juergen Hoeller eb50eec85b DataBinder uses a default limit of 256 for array/collection auto-growing (SPR-7842) 2011-07-03 20:39:19 +00:00
Juergen Hoeller 4faa5af3f8 backported bridge method detection for class hierarchies with mixed visibilities (SPR-7900) 2011-06-22 21:25:50 +00:00
Juergen Hoeller 218e64cc80 DefaultListableBeanFactory etc 2011-06-22 20:58:23 +00:00
Juergen Hoeller b82edcca04 DefaultListableBeanFactory is only deserializable through a SerializedBeanFactoryReference 2011-06-22 20:55:44 +00:00
Juergen Hoeller d8a4949faf getBean(name, type) attempts type conversion if necessary (SPR-8480) 2011-06-22 20:53:38 +00:00
Costin Leau 22739bebf3 + fix incorrect junit version in ivy.xml 2011-06-17 07:55:57 +00:00
Juergen Hoeller fece2c1125 restored support for String-to-ContextResource conversion (SPR-8383) 2011-06-15 15:46:41 +00:00
Juergen Hoeller 8b55b34d79 consistent dependency on Hibernate Validator 4.1.0.GA 2011-06-14 21:39:41 +00:00
Juergen Hoeller d1e998bedd refined WebLogic RMI descriptor to only mark 'getTargetInterfaceName' method as idempotent (SPR-8369) 2011-06-14 15:10:00 +00:00
Juergen Hoeller 2ddb14ae5b refined EntityManagerFactory proxy exception (SPR-4383) 2011-06-14 15:03:34 +00:00
Juergen Hoeller ae74fbdd4b prepared for 3.0.6 release 2011-06-14 00:13:15 +00:00
Juergen Hoeller 28769e906f ConversionService, CachedConnectionFactory, etc 2011-06-14 00:06:51 +00:00
Juergen Hoeller 47c21bf73b fixed NamedParameterJdbcTemplate's handling of arrays as query parameters (SPR-7699) 2011-06-14 00:03:57 +00:00
Juergen Hoeller 59fda2dbab restored original GenericConversionService behavior with respect to empty collections/maps; restored original FormattingConversionService behavior with respect to the use of subtypes; fixed collection element resolution when using a ConversionService with a DataBinder 2011-06-13 23:57:37 +00:00
Juergen Hoeller 43f8eca91b restored original GenericConversionService behavior with respect to empty collections/maps; restored original FormattingConversionService behavior with respect to the use of subtypes; fixed collection element resolution when using a ConversionService with a DataBinder 2011-06-13 23:40:22 +00:00
Juergen Hoeller 6cb6bd751e revised JMS CachedConnectionFactory to avoid unnecessary rollback calls on Session return (SPR-8437); fixed JMS CachedConnectionFactory to fully synchronize its Session list (SPR-8436) 2011-06-13 22:33:02 +00:00
Juergen Hoeller 58d68cef98 restored original ConversionService behavior with respect to empty collections/maps (SPR-7728) 2011-06-13 22:03:00 +00:00
Juergen Hoeller 5f3f30fdb4 revised JMS CachedConnectionFactory to avoid unnecessary rollback calls on Session return (SPR-8437); fixed JMS CachedConnectionFactory to fully synchronize its Session list (SPR-8436) 2011-06-13 21:43:56 +00:00
Juergen Hoeller 7a6b2cfe1f shortened build properties "org.junit.version" to "junit.version" and "org.testng.version" to "testng.version"; reverted SLF4J version back to 1.5.3 (for Hibernate 3.3.1 compatibility) 2011-06-09 13:51:30 +00:00
Juergen Hoeller a8ab9af002 updated dependencies 2011-06-08 22:50:20 +00:00
Juergen Hoeller ca19b14f13 first bunch of backports from 3.1 M2 to 3.0.6 2011-06-08 22:49:41 +00:00
Juergen Hoeller 175f6d4bc5 2011-06-08 13:25:01 +00:00
Chris Beams 0206845341 Spring 3.0.5 2010-10-20 23:33:02 +00:00
13004 changed files with 672921 additions and 1297190 deletions
-10
View File
@@ -1,10 +0,0 @@
root = true
[*.{adoc,bat,groovy,html,java,js,jsp,kt,kts,md,properties,py,rb,sh,sql,svg,txt,xml,xsd}]
charset = utf-8
[*.{groovy,java,kt,kts,xml,xsd}]
indent_style = tab
indent_size = 4
continuation_indent_size = 8
end_of_line = lf
-16
View File
@@ -1,16 +0,0 @@
# Normalize line endings to LF.
* text eol=lf
# Ensure that line endings for multipart files in spring-web are not modified.
*.multipart -text
# Ensure that line endings for DOS batch files are not modified.
*.bat -text
# Ensure the following are treated as binary.
*.gif binary
*.jar binary
*.jpeg binary
*.jpg binary
*.png binary
*.vsd binary
-17
View File
@@ -1,17 +0,0 @@
<!--
!!! For Security Vulnerabilities, please go to https://spring.io/security-policy !!!
-->
**Affects:** \<Spring Framework version>
---
<!--
Thanks for taking the time to create an issue. Please read the following:
- Questions should be asked on Stack Overflow.
- For bugs, specify affected versions and explain what you are trying to do.
- For enhancements, provide context and describe the problem.
Issue or Pull Request? Create only one, not both. GitHub treats them as the same.
If unsure, start with an issue, and if you submit a pull request later, the
issue will be closed as superseded.
-->
@@ -1,13 +0,0 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
permissions:
contents: read
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
+8 -46
View File
@@ -1,51 +1,13 @@
*.java.hsp
*.sonarj
*.sw*
.DS_Store
.settings
.springBeans
bin
build.sh
.DS_Store
target
integration-repo
ivy-cache
jmx.log
jxl.log
jmx.log
derby.log
spring-test/test-output/
.gradle
argfile*
pom.xml
activemq-data/
classes/
/build
buildSrc/build
/spring-*/build
/spring-core/graalvm/build
/spring-core/kotlin-coroutines/build
/framework-bom/build
/framework-docs/build
/integration-tests/build
/src/asciidoc/build
target/
/target/
# Eclipse artifacts, including WTP generated manifests
.classpath
.project
spring-*/src/main/java/META-INF/MANIFEST.MF
# IDEA artifacts and output dirs
*.iml
*.ipr
*.iws
.idea
out
test-output
atlassian-ide-plugin.xml
.gradletasknamecache
# VS Code
.vscode/
cached-antora-playbook.yml
org.springframework.jdbc/derby.log
org.springframework.spring-parent/.classpath
org.springframework.spring-parent/.project
org.springframework.test/test-output/
spring-build/lib/docbook
-33
View File
@@ -1,33 +0,0 @@
Juergen Hoeller <jhoeller@vmware.com>
Juergen Hoeller <jhoeller@vmware.com> <jhoeller@pivotal.io>
Juergen Hoeller <jhoeller@vmware.com> <jhoeller@gopivotal.com>
Rossen Stoyanchev <rstoyanchev@vmware.com>
Rossen Stoyanchev <rstoyanchev@vmware.com> <rstoyanchev@pivotal.io>
Rossen Stoyanchev <rstoyanchev@vmware.com> <rstoyanchev@gopivotal.com>
Phillip Webb <pwebb@vmware.com>
Phillip Webb <pwebb@vmware.com> <pwebb@pivotal.io>
Phillip Webb <pwebb@vmware.com> <pwebb@gopivotal.com>
Chris Beams <cbeams@vmware.com>
Chris Beams <cbeams@vmware.com> <cbeams@pivotal.io>
Chris Beams <cbeams@vmware.com> <cbeams@gopivotal.com>
Arjen Poutsma <apoutsma@vmware.com>
Arjen Poutsma <apoutsma@vmware.com> <apoutsma@pivotal.io>
Arjen Poutsma <apoutsma@vmware.com> <apoutsma@gopivotal.com>
Arjen Poutsma <apoutsma@vmware.com> <poutsma@mac.com>
Oliver Drotbohm <odrotbohm@vmware.com>
Oliver Drotbohm <odrotbohm@vmware.com> <ogierke@vmware.com>
Oliver Drotbohm <odrotbohm@vmware.com> <ogierke@pivotal.io>
Oliver Drotbohm <odrotbohm@vmware.com> <ogierke@gopivotal.com>
Dave Syer <dsyer@vmware.com>
Dave Syer <dsyer@vmware.com> <dsyer@pivotal.io>
Dave Syer <dsyer@vmware.com> <dsyer@gopivotal.com>
Dave Syer <dsyer@vmware.com> <david_syer@hotmail.com>
Andy Clement <aclement@vmware.com>
Andy Clement <aclement@vmware.com> <aclement@pivotal.io>
Andy Clement <aclement@vmware.com> <aclement@gopivotal.com>
Andy Clement <aclement@vmware.com> <andrew.clement@gmail.com>
Sam Brannen <sbrannen@vmware.com>
Sam Brannen <sbrannen@vmware.com> <sbrannen@pivotal.io>
Sam Brannen <sbrannen@vmware.com> <sam@sambrannen.com>
<dmitry.katsubo@gmail.com> <dmitry.katsubo@gmai.com>
Nick Williams <nicholas@nicholaswilliams.net>
-3
View File
@@ -1,3 +0,0 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=8.0.382-librca
-44
View File
@@ -1,44 +0,0 @@
= Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open
and welcoming community, we pledge to respect all people who contribute through reporting
issues, posting feature requests, updating documentation, submitting pull requests or
patches, and other activities.
We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses,
without explicit permission
* Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this
Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
that they deem inappropriate, threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to fairly and
consistently applying these principles to every aspect of managing this project. Project
maintainers who do not follow or enforce the Code of Conduct may be permanently removed
from the project team.
This Code of Conduct applies both within project spaces and in public spaces when an
individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
contacting a project maintainer at spring-code-of-conduct@pivotal.io . All complaints will
be reviewed and investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. Maintainers are obligated to maintain confidentiality
with regard to the reporter of an incident.
This Code of Conduct is adapted from the
https://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
-131
View File
@@ -1,131 +0,0 @@
# Contributing to the Spring Framework
First off, thank you for taking the time to contribute! :+1: :tada:
### Table of Contents
* [Code of Conduct](#code-of-conduct)
* [How to Contribute](#how-to-contribute)
* [Discuss](#discuss)
* [Create an Issue](#create-an-issue)
* [Issue Lifecycle](#issue-lifecycle)
* [Submit a Pull Request](#submit-a-pull-request)
* [Build from Source](#build-from-source)
* [Source Code Style](#source-code-style)
* [Reference Docs](#reference-docs)
### Code of Conduct
This project is governed by the [Spring Code of Conduct](CODE_OF_CONDUCT.adoc).
By participating you are expected to uphold this code.
Please report unacceptable behavior to spring-code-of-conduct@pivotal.io.
### How to Contribute
#### Discuss
If you have a question, check Stack Overflow using
[this list of tags](https://stackoverflow.com/questions/tagged/spring+or+spring-mvc+or+spring-aop+or+spring-jdbc+or+spring-transactions+or+spring-annotations+or+spring-jms+or+spring-el+or+spring-test+or+spring+or+spring-remoting+or+spring-orm+or+spring-jmx+or+spring-cache+or+spring-webflux?tab=Newest).
Find an existing discussion, or start a new one if necessary.
If you believe there is an issue, search through
[existing issues](https://github.com/spring-projects/spring-framework/issues) trying a
few different ways to find discussions, past or current, that are related to the issue.
Reading those discussions helps you to learn about the issue, and helps us to make a
decision.
#### Create an Issue
Reporting an issue or making a feature request is a great way to contribute. Your feedback
and the conversations that result from it provide a continuous flow of ideas. However,
before creating a ticket, please take the time to [discuss and research](#discuss) first.
If creating an issue after a discussion on Stack Overflow, please provide a description
in the issue instead of simply referring to Stack Overflow. The issue tracker is an
important place of record for design discussions and should be self-sufficient.
Once you're ready, create an issue on
[GitHub](https://github.com/spring-projects/spring-framework/issues).
#### Issue Lifecycle
When an issue is first created, it is flagged `waiting-for-triage` waiting for a team
member to triage it. Once the issue has been reviewed, the team may ask for further
information if needed, and based on the findings, the issue is either assigned a target
milestone or is closed with a specific status.
When a fix is ready, the issue is closed and may still be re-opened until the fix is
released. After that the issue will typically no longer be reopened. In rare cases if the
issue was not at all fixed, the issue may be re-opened. In most cases however any
follow-up reports will need to be created as new issues with a fresh description.
#### Submit a Pull Request
1. If you have not previously done so, please sign the
[Contributor License Agreement](https://cla.pivotal.io/sign/spring). You will be reminded
automatically when you submit the PR.
1. Should you create an issue first? No, just create the pull request and use the
description to provide context and motivation, as you would for an issue. If you want
to start a discussion first or have already created an issue, once a pull request is
created, we will close the issue as superseded by the pull request, and the discussion
about the issue will continue under the pull request.
1. Always check out the `main` branch and submit pull requests against it
(for target version see [settings.gradle](settings.gradle)).
Backports to prior versions will be considered on a case-by-case basis and reflected as
the fix version in the issue tracker.
1. Choose the granularity of your commits consciously and squash commits that represent
multiple edits or corrections of the same logical change. See
[Rewriting History section of Pro Git](https://git-scm.com/book/en/Git-Tools-Rewriting-History)
for an overview of streamlining the commit history.
1. Format commit messages using 55 characters for the subject line, 72 characters per line
for the description, followed by the issue fixed, e.g. `Closes gh-22276`. See the
[Commit Guidelines section of Pro Git](https://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project#Commit-Guidelines)
for best practices around commit messages, and use `git log` to see some examples.
1. If there is a prior issue, reference the GitHub issue number in the description of the
pull request.
If accepted, your contribution may be heavily modified as needed prior to merging.
You will likely retain author attribution for your Git commits granted that the bulk of
your changes remain intact. You may also be asked to rework the submission.
If asked to make corrections, simply push the changes against the same branch, and your
pull request will be updated. In other words, you do not need to create a new pull request
when asked to make changes.
#### Participate in Reviews
Helping to review pull requests is another great way to contribute. Your feedback
can help to shape the implementation of new features. When reviewing pull requests,
however, please refrain from approving or rejecting a PR unless you are a core
committer for the Spring Framework.
### Build from Source
See the [Build from Source](https://github.com/spring-projects/spring-framework/wiki/Build-from-Source)
wiki page for instructions on how to check out, build, and import the Spring Framework
source code into your IDE.
### Source Code Style
The wiki pages
[Code Style](https://github.com/spring-projects/spring-framework/wiki/Code-Style) and
[IntelliJ IDEA Editor Settings](https://github.com/spring-projects/spring-framework/wiki/IntelliJ-IDEA-Editor-Settings)
define the source file coding standards we use along with some IDEA editor settings we customize.
### Reference Docs
The reference documentation is in the [src/docs/asciidoc](src/docs/asciidoc) directory, in
[Asciidoctor](https://asciidoctor.org/) format. For trivial changes, you may be able to browse,
edit source files, and submit directly from GitHub.
When making changes locally, execute `./gradlew asciidoctor` and then browse the result under
`build/docs/ref-docs/html5/index.html`.
Asciidoctor also supports live editing. For more details see
[AsciiDoc Tooling](https://docs.asciidoctor.org/asciidoctor/latest/tooling/).
-202
View File
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-38
View File
@@ -1,38 +0,0 @@
# <img src="src/docs/spring-framework.png" width="80" height="80"> Spring Framework [![Build Status](https://ci.spring.io/api/v1/teams/spring-framework/pipelines/spring-framework-5.3.x/jobs/build/badge)](https://ci.spring.io/teams/spring-framework/pipelines/spring-framework-5.3.x?groups=Build") [![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.spring.io/scans?search.rootProjectNames=spring)
This is the home of the Spring Framework: the foundation for all [Spring projects](https://spring.io/projects). Collectively the Spring Framework and the family of Spring projects are often referred to simply as "Spring".
Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the [Overview](https://docs.spring.io/spring/docs/current/spring-framework-reference/overview.html#spring-introduction) section as reference for a more complete introduction.
## Code of Conduct
This project is governed by the [Spring Code of Conduct](CODE_OF_CONDUCT.adoc). By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io.
## Access to Binaries
For access to artifacts or a distribution zip, see the [Spring Framework Artifacts](https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Artifacts) wiki page.
## Documentation
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/) and [source](src/docs/asciidoc)), GitHub [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
[API reference](https://docs.spring.io/spring-framework/docs/current/javadoc-api/). There are also [guides and tutorials](https://spring.io/guides) across Spring projects.
## Micro-Benchmarks
See the [Micro-Benchmarks](https://github.com/spring-projects/spring-framework/wiki/Micro-Benchmarks) wiki page.
## Build from Source
See the [Build from Source](https://github.com/spring-projects/spring-framework/wiki/Build-from-Source) wiki page and the [CONTRIBUTING.md](CONTRIBUTING.md) file.
## Continuous Integration Builds
Information regarding CI builds can be found in the [Spring Framework Concourse pipeline](ci/README.adoc) documentation.
## Stay in Touch
Follow [@SpringCentral](https://twitter.com/springcentral), [@SpringFramework](https://twitter.com/springframework), and its [team members](https://twitter.com/springframework/lists/team/members) on Twitter. In-depth articles can be found at [The Spring Blog](https://spring.io/blog/), and releases are announced via our [news feed](https://spring.io/blog/category/news).
## License
The Spring Framework is released under version 2.0 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0).
-11
View File
@@ -1,11 +0,0 @@
# Security Policy
## Supported Versions
Please see the
[Spring Framework Versions](https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions)
wiki page.
## Reporting a Vulnerability
Please see https://spring.io/security-policy.
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-spring-framework" default="precommit">
<path id="unit.test.bundles">
<pathelement location="../org.springframework.instrument"/>
<pathelement location="../org.springframework.instrument.tomcat"/>
<pathelement location="../org.springframework.core"/>
<pathelement location="../org.springframework.expression"/>
<pathelement location="../org.springframework.beans"/>
<pathelement location="../org.springframework.aop"/>
<pathelement location="../org.springframework.context"/>
<pathelement location="../org.springframework.transaction"/>
<pathelement location="../org.springframework.oxm"/>
<pathelement location="../org.springframework.jms"/>
<pathelement location="../org.springframework.jdbc"/>
<pathelement location="../org.springframework.web"/>
<pathelement location="../org.springframework.orm"/>
<pathelement location="../org.springframework.context.support"/>
<pathelement location="../org.springframework.aspects"/>
<pathelement location="../org.springframework.web.servlet"/>
<pathelement location="../org.springframework.web.portlet"/>
<pathelement location="../org.springframework.test"/>
<pathelement location="../org.springframework.web.struts"/>
</path>
<path id="bundles">
<pathelement location="../org.springframework.spring-parent"/>
<pathelement location="../org.springframework.asm"/>
<path refid="unit.test.bundles" />
<pathelement location="../org.springframework.integration-tests"/>
<pathelement location="../org.springframework.spring-library"/>
</path>
<property file="${basedir}/../build.properties"/>
<import file="${basedir}/package-top-level.xml"/>
<import file="${basedir}/publish-top-level.xml"/>
<import file="${basedir}/publish-documentation.xml"/>
<import file="${basedir}/../spring-build/multi-bundle/default.xml"/>
<target name="precommit" depends="clean, clean-integration, test"/>
<presetdef name="javadoc.links">
<javadoc>
<link href="http://java.sun.com/javase/6/docs/api"/>
<link href="http://java.sun.com/j2ee/1.4/docs/api"/>
<link href="http://aopalliance.sourceforge.net/doc"/>
<!-- Caucho Burlap/Hessian -->
<link href="http://cglib.sourceforge.net/apidocs"/>
<!-- EasyMock -->
<link href="http://ehcache.sourceforge.net/apidocs"/>
<link href="http://freemarker.sourceforge.net/docs/api/"/>
<link href="http://www.hibernate.org/hib_docs/v3/api"/>
<!-- iBATIS -->
<!-- iText -->
<!-- Commons Attributes -->
<link href="http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/"/>
<link href="http://jakarta.apache.org/commons/dbcp/apidocs/"/>
<link href="http://jakarta.apache.org/commons/fileupload/apidocs/"/>
<link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
<link href="http://jakarta.apache.org/commons/logging/apidocs/"/>
<link href="http://jakarta.apache.org/commons/pool/apidocs/"/>
<!-- JasperReports -->
<!-- JDO -->
<!-- JMX -->
<!-- JOTM -->
<!-- JPA -->
<!-- JSF -->
<link href="http://junit.sourceforge.net/javadoc_40/"/>
<link href="http://logging.apache.org/log4j/docs/api/"/>
<link href="http://jakarta.apache.org/regexp/apidocs/"/>
<link href="http://jakarta.apache.org/poi/apidocs/"/>
<link href="http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/"/>
<link href="http://www.opensymphony.com/quartz/api/"/>
<link href="http://struts.apache.org/struts-doc-1.2.9/api/"/>
<link href="http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/"/>
<link href="http://tiles.apache.org/framework/apidocs/"/>
<link href="http://velocity.apache.org/engine/devel/apidocs/"/>
</javadoc>
</presetdef>
</project>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="package-bundle">
<target name="package" depends="ivy.init">
<dist-jar/>
<src-jar/>
</target>
</project>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="package-library">
<target name="package" depends="ivy.init">
<dist-jar/>
</target>
</project>
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="package-top-level">
<target name="package" description="Creates the release package for this project">
<delete dir="${package.output.dir}" quiet="true"/>
<mkdir dir="${package.output.dir}"/>
<delete file="${package.output.file}" quiet="true"/>
<mkdir dir="${artifacts.dir}"/>
<all-bundles target="package">
<property name="package.output.dir" value="${package.output.dir}"/>
</all-bundles>
<ant target="javadoc-api" inheritAll="false">
<property name="target.dir" value="${package.docs.dir}"/>
</ant>
<!-- Reference Document START-->
<path id="doc.projects">
<path location="${basedir}/../spring-framework-reference"/>
</path>
<all-bundles target="doc" buildpathRef="doc.projects"/>
<delete>
<fileset dir="${basedir}/../spring-framework-reference" includes="**/*.zip"/>
</delete>
<all-bundles target="package" buildpathRef="doc.projects">
<property name="package.output.dir" value="${package.output.dir}"/>
</all-bundles>
<!-- Reference Document END-->
<copy todir="${package.output.dir}">
<fileset dir="${basedir}/resources"/>
</copy>
<copy todir="${package.output.dir}/projects">
<fileset dir="${basedir}/..">
<exclude name="*/target/**"/>
<exclude name="integration-repo/**"/>
<exclude name="ivy-cache/**"/>
<exclude name="spring-build/lib/docbook/**" />
<exclude name="**/*OLD*/**"/>
</fileset>
</copy>
<replaceregexp match="build.stamp.*\n" replace="" flags="g"
file="${package.output.dir}/projects/build.properties"/>
<replaceregexp match="release.type=.*" replace="release.type=integration" flags="g"
file="${package.output.dir}/projects/build.properties"/>
<zip destfile="${package.output.file}">
<zipfileset dir="${package.dir}">
<exclude name="${package.basename}/docs/**"/>
</zipfileset>
</zip>
<zip destfile="${artifacts.dir}/${package.basename}-with-docs.zip">
<zipfileset dir="${package.dir}"/>
</zip>
<zip destfile="${artifacts.dir}/${package.basename}-dependencies.zip">
<zipfileset dir="${basedir}/../ivy-cache/repository">
<exclude name="org.apache.velocity/org.apache.velocity.docbookframework.dist/**"/>
</zipfileset>
</zip>
</target>
</project>
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="publish-documentation">
<!-- Main targets -->
<target name="publish-documentation" depends="publish-documentation.init">
<sshexec host="static.springsource.org" username="${username}" keyfile="${key.file}" passphrase="${passphrase}"
command="mkdir /opt/www/domains/springframework.org/www/htdocs/spring/docs/${bundle.version}"/>
<scp remoteToDir="${username}@static.springsource.org:/opt/www/domains/springframework.org/www/htdocs/spring/docs/${bundle.version}"
keyfile="${key.file}" passphrase="${passphrase}" sftp="true" verbose="true">
<fileset dir="${package.output.dir}">
<include name="changelog.txt" />
<include name="license.txt" />
<include name="readme.txt" />
</fileset>
<fileset dir="${package.docs.dir}" />
</scp>
<sshexec host="static.springsource.org" username="${username}" keyfile="${key.file}" passphrase="${passphrase}"
command="rm /opt/www/domains/springframework.org/www/htdocs/spring/docs/3.0.x ; ln -s /opt/www/domains/springframework.org/www/htdocs/spring/docs/${bundle.version} /opt/www/domains/springframework.org/www/htdocs/spring/docs/3.0.x"/>
</target>
<!-- Other targets -->
<target name="publish-documentation.init">
<fail message="The 'username' property must be set">
<condition>
<not>
<isset property="username"/>
</not>
</condition>
</fail>
<fail message="The 'key.file' property must be set">
<condition>
<not>
<isset property="key.file"/>
</not>
</condition>
</fail>
<fail message="The 'passphrase' property must be set">
<condition>
<not>
<isset property="passphrase"/>
</not>
</condition>
</fail>
</target>
</project>
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="publish-top-level" xmlns:aws="antlib:org.springframework.build.aws">
<target name="publish" depends="publish-package, publish-multi-bundle.publish"
description="Publish package, Ivy, and Maven artifacts"/>
<target name="publish-package" depends="aws.init">
<checksum file="${package.output.file}" algorithm="sha1"/>
<checksum file="${artifacts.dir}/${package.basename}-with-docs.zip" algorithm="sha1"/>
<checksum file="${artifacts.dir}/${package.basename}-dependencies.zip" algorithm="sha1"/>
<aws:s3 accessKey="${accessKey}" secretKey="${secretKey}">
<upload bucketName="dist.${bucket.basename}" file="${package.output.file}"
toFile="${adjusted.release.type}/${project.key}/${package.file.name}" publicRead="true">
<metadata name="project.name" value="Spring Framework"/>
<metadata name="release.type" value="${release.type}"/>
<metadata name="bundle.version" value="${bundle.version}"/>
<metadata name="package.file.name" value="${package.file.name}"/>
</upload>
<upload bucketName="dist.${bucket.basename}" file="${package.output.file}.sha1"
toFile="${adjusted.release.type}/${project.key}/${package.file.name}.sha1" publicRead="true"/>
<upload bucketName="dist.${bucket.basename}" file="${artifacts.dir}/${package.basename}-with-docs.zip"
toFile="${adjusted.release.type}/${project.key}/${package.basename}-with-docs.zip" publicRead="true">
<metadata name="project.name" value="Spring Framework"/>
<metadata name="release.type" value="${release.type}"/>
<metadata name="bundle.version" value="${bundle.version}"/>
<metadata name="package.file.name" value="${package.basename}-with-docs.zip"/>
</upload>
<upload bucketName="dist.${bucket.basename}" file="${artifacts.dir}/${package.basename}-with-docs.zip.sha1"
toFile="${adjusted.release.type}/${project.key}/${package.basename}-with-docs.zip.sha1" publicRead="true"/>
<upload bucketName="dist.${bucket.basename}" file="${artifacts.dir}/${package.basename}-dependencies.zip"
toFile="${adjusted.release.type}/${project.key}/${package.basename}-dependencies.zip" publicRead="true">
<metadata name="project.name" value="Spring Framework"/>
<metadata name="release.type" value="${release.type}"/>
<metadata name="bundle.version" value="${bundle.version}"/>
<metadata name="package.file.name" value="${package.basename}-dependencies.zip"/>
</upload>
<upload bucketName="dist.${bucket.basename}" file="${artifacts.dir}/${package.basename}-dependencies.zip.sha1"
toFile="${adjusted.release.type}/${project.key}/${package.basename}-dependencies.zip.sha1" publicRead="true"/>
</aws:s3>
</target>
</project>
+27
View File
@@ -0,0 +1,27 @@
This is where the master build that creates releases of Spring Framework resides. The build system is based on spring-build, which is linked in using an SVN external to https://src.springframework.org/svn/spring-build.
USERS
- To build all Spring Framework projects, including samples:
1. From this directory, run:
ant
Build Pre-requisites:
- javac 1.6 or > must be in your system path
- ant 1.7 or > must be in your system path
DEVELOPERS
- To build a new Spring Framework distribution for release:
1. Update the files containing the version number to reflect the new release version, if necessary.
build.properties
build-spring-framework/resources/readme.txt
spring-framework/src/spring-framework-reference.xml
2. From this directory, run:
ant jar package
The release archive will be created and placed in:
target/artifacts
@@ -0,0 +1,695 @@
SPRING FRAMEWORK CHANGELOG
==========================
http://www.springsource.org
Changes in version 3.0.7 (2011-12-22)
-------------------------------------
* fixed GenericTypeResolver to consistently return null if not resolvable
* added proper "contentLength()" implementation to ByteArrayResource
* refined Resource "exists()" check for HTTP URLs to always return false for 404 status
* LocaleEditor and StringToLocaleConverter do not restrict variant part through validation
* LinkedCaseInsensitiveMap overrides putAll method as well (for IBM JDK 1.6 compatibility)
* ConversionService prevents Converter from trying to convert to a subtype of its actual target type
* ConversionService is able to work with "Collections.emptyList()" as target type (again)
* CollectionCollection/MapToMapConverter preserve original Collection/Map if no converted elements
* fixed nested element conversion with a DataBinder + ConversionService + PropertyEditor
* restored DataBinder's ability to bind to an auto-growing List with unknown element type
* optimized DefaultListableBeanFactory's PropertyDescriptor caching for concurrent access
* context:property-placeholder's "file-encoding" attribute value is being applied correctly
* SpringValidatorAdapter accepts non-indexed set paths (for Hibernate Validator compatibility)
* fixed AbstractAsyncExecutionAspect's setExecutor method to correctly wrap in a TaskExecutorAdapter
* @Transactional qualifiers match against transaction manager definitions in parent contexts as well
* TransactionSynchronizationManager eagerly cleans up void ResourceHolders on any access
* updated H2 error codes in sql-error-codes.xml
* fixed NamedParameterJdbcTemplate to use correct maximum type for queryForInt/Long
* SimpleJdbcTestUtils executeSqlScript properly closes its LineNumberReader after use
* Hibernate synchronization properly unbinds Session even in case of afterCompletion exception
* JDO PersistenceManager synchronization performs close attempt after completion (if necessary)
* JPA EntityManagerFactoryUtils silently ignores IllegalArgumentExceptions from setHint calls
* added "forwarder" property to ConnectorServerFactoryBean, accepting an MBeanServerForwarder
* JmsInvokerClientInterceptor/FactoryBean always uses createConnection/createSession when on JMS 1.1
* RmiClientInterceptor detects nested SocketException as connect failure as well
* Servlet/PortletContextResource's getFile prefers "file:" URL resolution over calling getRealPath
* Portlet session mutex uses global session attribute to be shared among all portlets in the session
* fixed ServletServerHttpRequest to reconstruct from "request.getParameterMap()" for form POST only
* fixed @RequestMapping header matching to correctly process negated header conditions
* added "getObjectMapper()" accessor to MappingJacksonHttpMessageConverter
* ResourceHttpRequestHandler sends content without content-type header if no media type found
* AbstractCachingViewResolver allows for caching unresolved view names ("cacheUnresolved"=true)
* fixed "formMultiSelect"/"formCheckboxes" FreeMarker macros to compare against actual field value
Changes in version 3.0.6 (2011-08-18)
-------------------------------------
* fixed aspects bundle to declare dependencies for @Async aspect as well
* ProxyCreationContext uses "ThreadLocal.remove()" over "ThreadLocal.set(null)" as well
* DefaultListableBeanFactory is only deserializable through a SerializedBeanFactoryReference
* DefaultListableBeanFactory's getBean(name, type) attempts type conversion if necessary
* DefaultListableBeanFactory allows for init methods to register further bean definitions (again)
* XmlBeanDefinitionReader accepts description subelement within map entry as well (as per the XSD)
* ConfigurationClassPostProcessor supports use of same processor instance with several factories
* fixed potential InjectionMetadata NPE when using SpringBeanAutowiringInterceptor
* SpringBeanAutowiringSupport is able to process @Value annotations on any given target instance
* overridden @PersistenceContext annotations on subclass methods are being processed correctly
* BeanDefinitionVisitor now actually visits factory method names
* restored support for String-to-ContextResource conversion
* restored original GenericConversionService behavior with respect to empty collections/maps
* restored original FormattingConversionService behavior with respect to the use of subtypes
* added "formatters" property to FormattingConversionServiceFactoryBean
* collection/array conversion returns original collection if possible (instead of first element)
* fixed collection element resolution when using a ConversionService with a DataBinder
* DataBinder uses a default limit of 256 for array/collection auto-growing
* added "autoGrowNestedPaths" property to ConfigurableWebBindingInitializer
* Servlet/PortletRequestDataBinder perform unwrapping for MultipartRequest as well
* fixed AbstractBindingResult to avoid NPE in "hashCode()" if target is null
* fixed several HttpHeaders issues (charset handling, quoting/unquoting)
* SimpleClientHttpRequest uses fixed-length streaming mode (always sets content-length header)
* added "connectTimeout" and "readTimeout" properties to Simple/CommonsClientHttpRequestFactory
* explicit status code in RedirectView respected in HTTP 1.0 compatibility mode
* FormHttpMessageConverter correctly processes POST requests
* ResourceHttpRequestHandler does not set Content-Length header for 304 response
* ResourceHttpRequestHandler detects invalid directory traversal in given path
* LocaleChangeInterceptor validates locale values in order to prevent XSS vulnerability
* HtmlUtils properly escapes single quotes as well
* added support for web.xml context-param "springJspExpressionSupport" (explicit "true"/"false")
* ContextLoader and FrameworkServlet support "contextId" parameter for custom serialization id
* RemoteExporter uses an opaque proxy for 'serviceInterface' (no AOP interfaces exposed)
* added "acceptProxyClasses" flag to RemoteInvocationSerializingExporter
* refined WebLogic RMI descriptor to only mark 'getTargetInterfaceName' method as idempotent
* EhCacheManagerFactoryBean properly closes "ehcache.xml" input stream, if any
* revised JMS CachedConnectionFactory to avoid unnecessary rollback calls on Session return
* fixed JMS CachedConnectionFactory to fully synchronize its Session list
* fixed NamedParameterJdbcTemplate's handling of arrays as query parameters
* fixed JPA 2.0 timeout hints to correctly specify milliseconds
* updated Quartz package to support Quartz 1.8 as well (note: not supporting Quartz 2.0 yet)
* fixed @Rule execution order in SpringJUnit4ClassRunner to match standard JUnit 4 behavior
Changes in version 3.0.5 (2010-10-20)
-------------------------------------
* support for Hibernate 3.6 final
* added core serializer abstraction with default implementations using Java Serialization
* consistent use of JDK 1.5's "ThreadLocal.remove()" over "ThreadLocal.set(null)"
* fixed JodaTimeContextHolder to use a non-inheritable ThreadLocal and expose a reset method
* revised "ClassUtils.isAssignable" semantics to cover primitives vs wrappers in both directions
* optimized AnnotationUtils findAnnotation performance for repeated search on same interfaces
* ConversionService protects itself against infinite recursion in ObjectToCollectionConverter
* fixed TypeDescriptor to correctly resolve nested collections and their element types
* BeanWrapper does not attempt to populate Map values on access (just auto-grows Map itself)
* fixed Autowired/CommonAnnotationBeanPostProcessor to prevent race condition in skipping check
* fixed @Value injection to correctly cache temporary null results for non-singleton beans
* ApplicationContext registers context-specific ClassArrayEditor for its bean ClassLoader
* refined ApplicationContext singleton processing to not fail for manually registered null instances
* fixed ApplicationContext event processing for repeated invocations to non-singleton listener beans
* optimized @Bean error messages for static factory methods as well as for argument type mismatches
* modified expression parsing to pass full TypeDescriptor context through to ConversionService calls
* adapted expression parser's Constructor/MethodResolver to accept TypeDescriptors instead of raw types
* SpEL supports projection on any kind of Collection (not just on Lists and arrays)
* SpEL MapAccessor consistently rejects "target.key" style access to Maps if no such key is found
* SpEL method invocations prefer method with fewest parameters (e.g. no-arg over vararg)
* AspectJExpressionPointcut uses bean ClassLoader for initializing the AspectJ pointcut parser
* added AnnotationAsyncExecutionAspect as AspectJ-based variant of @Async processing
* added mode="proxy"/"aspectj" and proxy-target-class options to task:annotation-driven
* JDBC bundle uses local ClassLoader as bean ClassLoader for "sql-error-codes.xml" parsing
* EmbeddedDatabaseFactory shuts down database when failing to populate it in "initDatabase()"
* embedded database support now also works with Derby >= 10.6
* "jdbc:embedded-database" uses id as database name to allow multiple ones in parallel
* ResourceDatabasePopulator throws descriptive ScriptStatementFailedException with resource details
* added configurable Connection/Statement/ResultSet target types to Jdbc4NativeJdbcExtractor
* added OracleJdbc4NativeJdbcExtractor with pre-configured Oracle JDBC API types
* DefaultLobHandler's "wrapAsLob" mode works with PostgreSQL's "getAsciiStream()" requirement
* ResultSetWrappingSqlRowSet (as used by JdbcTemplate's "queryForRowSet") supports column labels now
* LocalSessionFactoryBean's "entityCacheStrategies" works with region names on Hibernate 3.6 as well
* fixed DefaultMessageListenerContainer's no-message-received commit to work without Session caching
* DefaultMessageListenerContainer's skips no-message-received commit on Tibco (avoiding a deadlock)
* JaxWsPortClientInterceptor does not fall back to annotation-specified name as portName anymore
* UriTemplate is serializable now
* fixed AnnotationMethodHandlerAdapter's caching to avoid concurrency issues in RequestMappingInfo
* fixed @MVC processing of parameter-level annotations to work with interface-based proxies again
* revised @RequestParam processing to support CSV-to-array/collection binding with ConversionService
* fixed EvalTag's EvaluationContext caching to properly handle JSP tag caching across requests
* AbstractJasperReportsView only sets locale model attributes if not present already
* DispatcherPortlet throws custom NoHandlerFoundException instead of misleading UnavailableException
* DispatcherPortlet copies all action parameters to render parameters in case of an action exception
* DispatcherPortlet's default resource serving explicitly prevents access to WEB-INF and META-INF
* Portlet @ExceptionHandler methods allow for writing the response directly (like in the Servlet case)
* MockHttpServletRequest/HttpSession/etc returns independent Enumeration from "getAttributeNames()"
Changes in version 3.0.4 (2010-08-19)
-------------------------------------
* support for Hibernate Core 3.6, Hibernate Validator 4.1, EclipseLink 2.1, EHCache 2.2
* OSGi manifest version range accepts EHCache 2.x as well
* added "contentLength()" method to Resource abstraction
* URL-based Resource variants introspect "last-modified" and "content-length" response headers
* refined "exists()" check for UrlResource (HEAD request) and ClassPathResource (URL resolution)
* ConversionService is able to deal with empty collections and nested collections (fixed regression)
* ConversionService properly handles nested Resource arrays in Map values (fixed regression)
* ConversionService does not accidentally use copy constructor for same type
* fixed double ConversionFailedException nesting for ObjectToObjectConverter invocations
* BeanWrapper preserves annotation information for individual array/list/map elements
* Spring's constructor resolution consistently finds non-public multi-arg constructors
* revised constructor argument caching, avoiding a race condition for converted argument values
* SpEL passes full collection type context (generics, annotations) to ConversionService
* SpEL 'select last' operator now works consistently with maps
* BeanWrapper/DataBinder's "autoGrowNestedPaths" works for Maps as well
* fixed concurrency issue in TypedStringValue, showing for nested typed Maps in prototype beans
* fixed WeakReferenceMonitor to never stop its monitoring thread if an entry has been registered
* fixed CronTrigger to correctly parse month parts expressed as numbers (1-12 instead of 0-11)
* TaskExecutorFactoryBean (as used by task:executor) exposes full ThreadPoolTaskExecutor type
* JmsResourceHolder does not ignore IllegalStateException from locally synchronized transaction
* fixed JMS CachingConnectionFactory to correctly cache a producer without fixed destination as well
* DefaultMessageListenerContainer triggers Session commit even if no message has been received
* DefaultMessageListenerContainer supports client id setting even for non-shared Connections
* Spring's MessageEndpointFactory classes are now JCA 1.6 compliant as well
* AbstractJaxWsServiceExporter supports "bindingType" bean property, overriding @BindingType
* AbstractJaxWsServiceExporter supports "webServiceFeatures" bean property on JAX-WS 2.2
* JaxWsPortProxyFactoryBean takes "wsdlDocumentUrl", "namespaceUri" etc defaults from @WebService
* Jaxb2Marshaller's "marshallerProperties" Map accepts any value type
* SpringTemplateLoader for FreeMarker supports last-modified timestamp through Resource abstraction
* HibernateJpaDialect correctly closes borrowed connections even for nested JDBC executions
* DefaultJdoDialect supports JDO 3.0 query timeout facility (as supported by DataNucleus 2.1)
* transaction names based on method id from most specific method (target class instead of interface)
* added "validationMessageSource" to LocalValidatorFactoryBean, for Spring-based validation messages
* Spring field error arguments include actually declared annotation attributes in alphabetical order
* JSR-303 Pattern message resolvable through Spring MessageSource (despite special characters)
* DispatcherServlet applies default view name translation to error views as well
* mvc:annotation-driven reliably detects JSR-303 and JAXB2 in an OSGi environment as well
* revised @MVC handler method resolution with respect to handler methods on generic interfaces
* @MVC handler methods reliably resolve MultipartRequest arguments with HiddenHttpMethodFilter
* WebDataBinder and @MVC request params detect and introspect MultipartFile arrays as well
* fixed @PathVariable regression in combination with ConversionService usage on DataBinder
* @CookieValue returns decoded cookie value in a Servlet environment (analogous to @RequestParam)
* MVC HandlerExceptionResolvers prevent caching for exception views if preventResponseCaching=true
* @ExceptionHandler works for inherited method and CGLIB proxies on Portlet controllers as well
* Portlet @MVC's implicit render model will be updated at the end of the event phase
* Portlet AbstractController consistently uses session mutex if "synchronizeOnSession" is active
* PortletWrappingController supports Portlet 2.0 resource and event requests as well
* fixed JSP EvalTag to render null result as empty String instead of "null" String
* JSP EvalTag resolves "@myBeanName" references in expressions against the WebApplicationContext
* added support for static resource serving: ResourceHttpRequestHandler, mvc:resources
* revised DispatcherServlet's last-modified handling to properly work with scoped controllers
* MockMultipartHttpServletRequest pre-defines method "POST" and content type "multipart/form-data"
Changes in version 3.0.3 (2010-06-15)
-------------------------------------
* Spring autodetects JodaTime 1.3 or higher (as required), ignoring older JodaTime versions
* clarified that Spring's Jackson support requires Jackson 1.3 or higher
* JPA 2.0 support tested and supported with Hibernate 3.5.2 and OpenJPA 2.0.0 GA as well
* revised VFS support for Spring's component scanning to work on JBoss AS 6.0.0 M3 as well
* fixed URIEditor's URI construction to consider fragment as well
* added default InputSourceEditor for SAX InputSource construction with a URL String as system id
* CachedIntrospectionResults only caches GenericTypeAwarePropertyDescriptors if fully safe
* revised BeanWrapper's exception wrapping to consistently handle ConversionExceptions
* DefaultListableBeanFactory checks for alias circle on registerAlias (avoiding endless loop)
* ConversionService is able to apply Converters to interface-based array elements
* ConversionService fully supports conversion from String to MediaType now (through 'valueOf')
* revised exception handling in ObjectToObjectConverter, avoiding InvocationTargetExceptions
* a context ConversionService is able to override an ApplicationContext's resource editors
* refined LifecycleProcessor exception handling, properly wrapping a start exception from a bean
* revised DefaultLifecycleProcessor's handling of circular dependencies to avoid stack overflow
* fixed constructor argument caching for prototypes with multiple constructor matches
* specific detection of CGLIB subclasses in order to properly handle CGLIB interfaces
* registerDependentBean resolves to the canonical bean name in order to handle alias references
* fixed registerResolvableDependency mechanism to correctly handle non-serializable factory objects
* added "expose-proxy" attribute to aop namespace (enforcing AopContext proxy exposure with CGLIB)
* revised AbstractInterceptorDrivenBeanDefinitionDecorator for further alignment with auto-proxying
* BeanDefinitionVisitor/PropertyPlaceholderConfigurer finds and resolves values in arrays as well
* property placeholders can deal with nested expressions which happen to use the same suffix
* SpEL's Elvis operator is able to deal with #{${myProp}?:defaultValue} case if myProp is empty
* introduced EmbeddedValueResolverAware callback interface for convenient placeholder resolution
* @Transactional qualifier value matches against @Qualifier annotations on @Bean methods as well
* setTransactionIsolation on JDBC Connection only called when actually necessary (for PostgreSQL)
* added limit for parsed SQL cache to NamedParameterJdbcTemplate (default is 256; configurable)
* CachingConnectionFactory detects destination equality for WebSphere MQ as well (using toString)
* DefaultPersistenceUnitManager's getPersistenceUnitInfo method has 2.5 compatible signature again
* DefaultMessageListenerContainer reacts to maxConcurrentConsumers reduction for long-lived tasks
* added "idleConsumerLimit" bean property to DefaultMessageListenerContainer (default is 1)
* AsyncAnnotationBeanPostProcessor consistently adds @Async processing as first Advisor in the chain
* ScheduledTaskRegistrar (as used for @Scheduled processing) properly shuts down its default executor
* CronTrigger defensively protects itself against accidental re-fires if a task runs too early
* MailSendException includes all messages as failed messages in case of a connect failure
* added support for JAX-WS 2.1 WebServiceFeatures to JaxWsPortClientInterceptor/PortProxyFactoryBean
* added XmlAwareFormHttpMessageConverter, taking over the 3.0.2-introduced XML multipart support
* ServletContextResourcePatternResolver handles "/WEB-INF/lib/*.jar!/**/context.xml" style patterns
* fixed MVC mapping regression for servlet url-pattern "/" case on servers other than WebSphere
* MVC mappings properly apply even to welcome file entries that forward to a DispatcherServlet
* fixed @ExceptionHandler resolution in case of multiple matches at different inheritance levels
* revised Portlet SessionStatus.setComplete() to avoid re-exposure of attributes in render phase
* shortened Portlet MVC's implicit model render parameter name to "implicitModel"
* added convenient "checkRefresh" bean property to TilesConfigurer
* TilesConfigurer's "definitionsFactoryClass" property applies common Tiles DefinitionsFactory setup
* JSP FormTag calculates proper default form action even when using a rewrite filter on WebSphere
* JSP HiddenInputTag allows for using common HTML attributes (equivalent to LabelTag)
* fixed JSP ErrorsTag to avoid invalid "*.errors" id, using form object name as id prefix instead
* fixed JSP SelectTag's support for rendering enum constants
* JSP Radiobutton/CheckboxesTag utilizes PropertyEditor/ConversionService for label rendering
* MockHttpServletResponse supports multiple includes
Changes in version 3.0.2 (2010-04-02)
-------------------------------------
* fixed cross-module version ranges in OSGi manifests
* fixed contents of org.springframework.web.struts jar
* upgraded to Hibernate Validator 4.0.2 and Jackson 1.4.2
* compatibility with Hibernate 3.5 final (native and also as a JPA 2.0 provider)
* compatibility with OpenJPA 2.0 (support for JPA 2.0 persistence.xml versioning)
* compatibility with Hessian 4.0 (in terms of exception propagation)
* compatibility with JasperReports 3.x (in terms of resource management)
* restored full compatibility with Servlet 2.4 containers on all VMs
* PropertyEditor lookup fallback works on Google App Engine as well
* fixed TypeDescriptor/MethodParameter toString for all cases in debug log messages
* widened AbstractFactoryBean's "getObjectType" signature to return any Class as well
* BeanPostProcessors are allowed to return a null bean value in the middle of the chain
* autowire="byType" ignores parameter name when choosing a primary bean, as defined
* ObjectFactoryCreatingFactoryBean creates a serializable ObjectFactory reference
* added ProviderCreatingFactoryBean, exposing a serializable JSR-330 Provider reference
* "conversionService" bean will be ignored if it is not of type ConversionService
* revised AbstractInterceptorDrivenBeanDefinitionDecorator for alignment with auto-proxying
* SimpleJdbcCall's "returningResultSet" accepts any plain RowMapper now
* added public "validateDatabaseSchema" method to Hibernate LocalSessionFactoryBean
* HibernateJpaDialect borrows JDBC Connection on demand (supporting aggressive release)
* JCA listener containers delegate to wrapped Transaction handle (for Geronimo compatibility)
* @Transactional qualifiers work in unit tests as well (TransactionalTestExecutionListener)
* @Value processing works in test instances (using the test context framework) as well now
* @DirtiesContext is now inherited for class-level usage
* NativeWebRequest detects native MultipartRequest when decorated by HiddenHttpMethodFilter
* WebRequestInterceptor exposes HttpServletResponse through NativeWebRequest (after downcast)
* WebContentInterceptor does not restrict HTTP methods by default anymore
* WebApplicationObjectSupport's initServletContext will be called only once in any scenario
* DispatcherPortlet passes handler instance into HandlerExceptionResolver for action exception
* DispatcherPortlet applies preHandleRender callbacks in case of action exception as well
* UrlPathHelper cuts off trailing servlet-path slashes for root mappings (on WebSphere)
* introduced support for HttpEntity and ResponseEntity wrappers, adding context to body values
* fixed DataBinder's conversion error handling for direct field access with ConversionService
* @InitBinder methods support all applicable Spring 3.0 parameter annotations as well
* fixed @RequestParam(required=false) regression for @InitBinder methods
* @ExceptionHandler methods consistently receive original exception
* fixed indexed property binding regression in form tag library
* fixed @Configurable issue with null bean name
Changes in version 3.0.1 (2010-02-18)
-------------------------------------
* upgraded to AspectJ 1.6.8
* full support for JPA 2.0 persistence schema and PersistenceUnitInfo SPI
* support for JPA PersistenceContext/Unit injection on Google App Engine
* support for Hibernate 3.5 (as native Hibernate API and as JPA 2.0 provider)
* support for Tiles 2.2.1 (preserving compatibility with Tiles 2.1.2 and above)
* consistent treatment of unresolvable placeholders for Resource and Resource array properties
* ConversionFailedException exDLBFposes offending value through public "getValue()" method
* fixed BeanFactory's "getBeansWithAnnotation" to ignore beans with non-determinable type
* widened FactoryBean's "getObjectType" signature to return any Class (Class<?>)
* do not ever consider Object as a candidate type for autowiring by type (autowire="byType")
* BeanDefinitionReader and ClassPath/FileSystemXmlApplicationContext use varargs where possible
* introduced BeanDefinitionRegistryPostProcessor extension to BeanFactoryPostProcessor
* @Configuration classes support definition of BeanFactoryPostProcessor beans
* component-scan's scoped-proxy attribute applies to scope-annotated singleton beans as well
* generic ApplicationListener event type gets detected through AOP proxy as well
* ApplicationListeners will only be executed once per event (even for scripted objects)
* ApplicationListeners will get detected lazily as well (e.g. on @Bean's concrete result)
* inner bean ApplicationListeners will be invoked through their proxy (if any)
* fixed SimpleApplicationEventMulticaster's retriever caching to allow for proper removal
* context-specific "conversionService" bean may refer to annotation-configured converter beans
* refined DefaultLifecycleProcessor's start/stop logging and stop exception handling
* DefaultLifecycleProcessor allows for overriding specific hooks in subclasses
* BeanNameAutoProxyCreator detects alias matches for specified bean names
* proxies with AspectJ pointcuts are fully serializable within a BeanFactory now
* SharedEntityManagerCreator's EntityManager proxies are fully serializable now
* Query call chaining works with shared EntityManager proxy outside of transaction as well
* TransactionInterceptor is able to serialize "transactionManagerBeanName" as well
* non-matching @Transactional qualifier value will lead to IllegalStateException
* fixed WebSphereUowTransactionManager regression: correctly roll back in case of exception
* JndiObjectFactoryBean explicitly only chooses public interfaces as default proxy interfaces
* added vararg variants of query methods to JdbcTemplate (as known from SimpleJdbcTemplate)
* MBeanClientInterceptor/MBeanProxyFactoryBean understands CompositeData/TabularData arrays
* added "workManagerMBeanName" property to JBossWorkManagerTaskExecutor
* task:executor's id value is now used as thread name prefix of ThreadPoolTaskExecutor
* fixed @Scheduled processing to kick in once only even in an ApplicationContext hierarchy
* fixed MediaType's Comparable behavior to do a full comparison, aligned with equals behavior
* added "sortBySpecificity" method to MediaType, for typical use with accept header matching
* MimeMessageHelper encodes from, to, cc, bcc String addresses with given encoding as well
* changed HttpStatus.REQUEST_TOO_LONG constant to REQUEST_ENTITY_TOO_LARGE
* relaxed generic Class declaration in HttpMessageConverter's canRead/canWrite/read signatures
* fixed "mvc:view-controller" to work in a fully isolated fashion on Spring Dynamic Modules
* DefaultRequestToViewNameTranslator strips trailing slashes as well (can also be turned off)
* @RequestParam/RequestHeader/CookieValue's defaultValue allows for declaring empty String
* @SessionAttributes works when used on an annotated controller interface with AOP proxying
* WebRequest is a resolvable dependency in Servlet/Portlet web application contexts
* revised JSP-based views to never fail when trying to set Servlet API forward attributes
* lenient evaluation of boolean 'true' attribute expressions in JSP form tag library
* added new spring:eval tag for evaluating SpEL expressions from JSP pages
* SpringBeanAutowiringSupport works in extra ClassLoaders as well (e.g. WebLogic JAX-WS)
Changes in version 3.0.0.GA (2009-12-16)
----------------------------------------
* component scanning autodetects the new EE 6 "javax.annotation.ManagedBean" stereotype
* updated JPA 2.0 support to the final spec (tested compatibility with EclipseLink 2.0 GA)
* full support for GlassFish V3 GA (includes component scanning and load-time weaving)
* upgraded to JRuby 1.4 (while remaining compatible with JRuby 1.1 and above)
* bean property names are matched leniently ("title" and "Title"; "ISBN" and "iSBN")
* bean properties of type enum array/collection can be populated with comma-separated String
* removed getBeansWithAnnotation(Class,boolean,boolean) method from ListableBeanFactory
* PropertyPlaceholderConfigurer is compatible with Spring 2.5 extensions (again)
* SmartLifecycle beans will get auto-started on demand even if marked as lazy-init
* MBeanExporter detects FactoryBean-exported resources independent from declaration order
* refactored SpelExpressionParser to accept SpelParserConfiguration object with boolean flags
* revised TypeDescriptor's valueOf and forObject factory methods with some level of caching
* revised GenericConverter's "getConvertibleTypes" signature to return Set of ConvertiblePair
* GenericConversionService prefers matches against inherited interfaces over superclasses
* renamed ConverterRegistry's addGenericConverter(GenericConverter) method to addConverter
* no default converters for Object-to-Map and Map-To-Object anymore
* default converter for String-to-Properties parsing only applies for actual Properties objects
* default ObjectToStringConverter only stringifies objects that indicate proper toString behavior
* added "converters" property to FormattingConversionServiceFactoryBean as well
* full support for formatters and formatting annotations on array/collection elements
* no default number formatter (relying on plain java.lang.Number parsing and rendering)
* no default formatters for Date/Calendar (requiring explicit use of @DateTimeFormat)
* BeanValidationPostProcessor runs in before-initialization phase (before init methods) by default
* removed MultipartRequest mixin interface again (avoiding a package dependency cycle)
* revised RestTemplate method signatures to accept Object values instead of just Strings
* revised path variable extraction to properly deal with dots in variable values (again)
* reintroduced createBinder template method in Servlet/Portlet AnnotationMethodHandlerAdapter
Changes in version 3.0.0.RC3 (2009-12-01)
-----------------------------------------
* prepared for Grails and ROO requirements
* restored compatibility with Apache CXF
* fixed bean definition import via "classpath*:" URLs
* added chaining-capable "add" method to MutablePropertyValues
* constructor arguments can be overridden by name in child bean definitions
* BeanDefinitions return isSingleton()=true by default again, with scope name empty
* init/destroy methods get processed in the order of declaration at each hierarchy level
* fixed lookup of LifecycleProcessor bean in a Spring Dynamic Modules environment
* refined lifecycle processing through introduction of startup/shutdown phases
* fixed transaction synchronization setup with TransactionAwareDataSourceProxy involved
* added support for Hibernate 3.3 RegionFactory cache SPI to LocalSessionFactoryBean
* JSR-303 SpringValidatorAdapter uses field name as first argument (analogous to bind errors)
* replaced DefaultConversionService with ConversionServiceFactory(Bean)
* revised FormatterRegistry interface and FormattingConversionServiceFactoryBean setup
* mvc:annotation-driven exposes default Validator and ConversionService as top-level beans
* mvc:annotation-driven registers applicable HttpMessageConverters by default, if available
* added interceptors support to mvc namespace, for path-based interceptor mappings
Changes in version 3.0.0.RC2 (2009-11-13)
-----------------------------------------
* updated to final versions of JSR-330 "javax.inject" and JSR-303 "javax.validation" APIs
* full compliance with the JSR-330 TCK (i.e. full compliance with the final specification)
* support for Hibernate Validator 4.0 GA (as the JSR-303 reference implementation)
* added support for load-time weaving in JBoss 5.x
* added support for recent EHCache 1.6 configuration properties to EHCacheFactoryBean
* added AnnotatedBeanDefinitionReader helper for programmatic registration of annotated classes
* added AnnotationConfig(Web)ApplicationContext for convenient registration/scanning of classes
* added GenericXmlApplicationContext with flexible configuration options for its XML support
* AbstractApplicationContext can also start up in case of system properties access failure
* internal MergedBeanDefinitionPostProcessors apply after all other post-processors
* inner beans detected as ApplicationListeners as well (only supported for inner singletons)
* child bean definition's scope attribute can be inherited from parent bean definition now
* introduced SmartLifecycle interface with auto-startup and shutdown order support
* introduced LifecycleProcessor delegate, customizable through "lifecycleProcessor" bean
* MessageListenerContainers and Quartz SchedulerFactoryBean start up on refresh instead of init
* added initialize-database tag to jdbc namespace for populating external data sources with data
* PathMatchingResourcePatternResolver leniently ignores non-existing root directories
* DefaultConversionService understands "on"/"off", "yes"/"no", "1"/"0" as boolean values
* CustomEditorConfigurer supports PropertyEditor instances again (with deprecation warning)
* revised MethodParameter's annotation accessor methods
* ClassUtils is now parameterized with Class<?> and Class<T> where appropriate
* DataBinder now accepts var-args to set allowed, disallowed, and required fields
* DataBinder auto-grows nested paths on traversal (avoiding NullValueInNestedPathException)
* fixed enum binding regression with WebRequestDataBinder (as used by @MVC data binding now)
* fixed FieldError to expose rejected input value as String value instead of as array
* JSR-303 Validator will only register validation failures if no binding failure happened
* ContentNegotiatingViewResolver works with ignoreAcceptHeader and defaultContentType as well
* added Spring MVC namespace, with convenient mvc:annotation-driven configuration element
* default number and datetime formatters configured when using the Spring MVC namespace
* full support for datetime formatting using the Joda Time library (automatically enabled)
* added convenient @NumberFormat and @DateTimeFormat annotations for declarative formatting
* implicit T.valueOf(S) and constructor T(S) lookup if no explicit S->T converter matches
* AbstractExcelView is compatible with Apache POI 3.0 as well as 3.5 now
* TilesConfigurer only sets up EL support if JSP 2.1 is present (for JSP 2.0 compatibility)
* re-introduced Struts 1.x support ("org.springframework.web.struts") in deprecated form
* deprecated scheduling support for JDK 1.3 Timer ("org.springframework.scheduling.timer")
* deprecated remoting support for JAX-RPC (in favor of JAX-WS)
Changes in version 3.0.0.RC1 (2009-09-25)
-----------------------------------------
* upgraded to CGLIB 2.2, AspectJ 1.6.5, Groovy 1.6.3, EHCache 1.6.2, JUnit 4.7, TestNG 5.10
* introduced early support for JSR-330 "javax.inject" annotations (for autowiring)
* introduced early support for JSR-303 Bean Validation (setup and MVC integration)
* added default editors for "java.util.Currency" and "java.util.TimeZone"
* refined PathMatchingResourcePatternResolver's treatment of non-readable directories
* PathMatchingResourcePatternResolver understands VFS resources (i.e. works on JBoss 5.x)
* revised AccessControlContext access from BeanFactory
* AbstractBeanDefinitionParser can deal with null return value as well
* PropertyOverrideConfigurer's "ignoreInvalidKeys" ignores invalid property names as well
* PropertyPlaceholderConfigurer supports "${myKey:myDefaultValue}" defaulting syntax
* BeanFactory's default type conversion falls back to String constructor on target type
* BeanFactory tries to create unknown collection implementation types via default constructor
* BeanFactory supports ObjectFactory as a dependency type for @Autowired and @Value
* BeanFactory supports JSR-330 Provider interface as a dependency type for @Inject
* BeanFactory prefers local primary bean to primary bean in parent factory
* protected @Autowired method can be overridden with non-annotated method to suppress injection
* private @Autowired methods with same signature will be called individually across a hierarchy
* @PostConstruct processed top-down (base class first); @PreDestroy bottom-up (subclass first)
* ConfigurationClassPostProcessor detect @Bean methods on registered plain bean classes as well
* support for default "conversionService" bean in an ApplicationContext
* MBeanServerFactoryBean returns JDK 1.5 platform MBeanServer for agent id "" (empty String)
* changed NamedParameter/SimpleJdbcOperations parameter signatures to accept any Map value type
* refined logging in JMS SingleConnectionFactory and DefaultMessageListenerContainer
* introduced "ui.format" package as an alternative to PropertyEditors for data binding
* @RequestMapping annotation now supported for annotated interfaces (and JDK proxies) as well
* @RequestParam and co support placeholders and expressions in their defaultValue attributes
* @Value expressions supported as MVC handler method arguments as well (against request scope)
* JSR-303 support for validation of @MVC handler method arguments driven by @Valid annotations
* refined response handling for @ExceptionHandler methods
* @ResponseStatus usage in handler methods detected by RedirectView
* all @SessionAttributes get exposed to the model before handler method execution
* @Event/ResourceMapping uniquely mapped to through event/resource id, even across controllers
* MultipartRequest is available as a mixin interface on (Native)WebRequest as well
* removed outdated "cacheJspExpressions" feature from ExpressionEvaluationUtils
* introduced common ErrorHandler strategy, supported by message listener container
* Jpa/JdoTransactionManager passes resolved timeout into Jpa/JdoDialect's beginTransaction
* HibernateJpaDialect applies timeout onto native Hibernate Transaction before begin call
* Spring's Hibernate support is now compatible with Hibernate 3.5 beta 1 as well
* Spring's JPA support is now fully compatible with JPA 2.0 as in EclipseLink 2.0.0.M7
* SpringJUnit4ClassRunner is now compatible with JUnit 4.5, 4.6, and 4.7
* SpringJUnit4ClassRunner once again supports collective timeouts for repeated tests
* deprecated @NotTransactional annotation for test classes in favor of @BeforeTransaction
Changes in version 3.0.0.M4 (2009-08-10)
----------------------------------------
* upgraded to JUnit 4.6, TestNG 5.9, and EasyMock 2.5.1
* updated all Spring Framework OSGI manifests to list unversioned imports explicitly
* relaxed several OSGi bundle dependencies (optional, extended version ranges)
* revised Java 6 checks to test for the presence of specific Java 6 interfaces/classes only
* replaced Commons Collections dependency with Spring-provided LinkedCaseInsensitiveMap
* case-insensitive Maps and key Sets preserve original casing for introspection/logging
* constructor argument type matching supports arrays and simple class names now
* XML constructor-arg element allows for specifying a constructor argument by name now
* XML import elements with relative resource patterns are supported as well now
* introduced non-lenient constructor resolution mode for BeanDefinitions (for RFC-124)
* revised DefaultListableBeanFactory's access control when running within a SecurityManager
* BeanWrapper and DefaultListableBeanFactory accept a custom ConversionService now
* DefaultListableBeanFactory references are serializable now when initialized with an id
* scoped proxies are serializable now, for web scopes as well as for singleton beans
* injected request/session references are serializable proxies for the current request now
* Servlet/Portlet ApplicationContexts use a specific id based on servlet/portlet name
* ReloadableResourceBundleMessageSource correctly calculates filenames for all locales now
* @PostConstruct works for multiple private init methods of the same name in a hierarchy
* @Primary/@Lazy/@DependsOn supported as meta-annotations as well
* @Bean/@Scope etc supported as meta-annotations on factory methods as well now
* @Required does not get processed on beans returned by @Bean factory methods
* @Import detects and accepts existing configuration class of the desired type
* @Transactional supports qualifier value for choosing between multiple transaction managers
* WebSphereUowTransactionManager falls back to UOWManagerFactory lookup by default
* JMS SingleConnectionFactory performs start call within connection monitor (for Oracle AQ)
* @ManagedResource is marked as inherited now, for generic management-aware base classes
* introduced dedicated @ManagedMetric annotation for metric attributes in a JMX environment
* added task namespace with scheduler/executor configuration and scheduled task definitions
* added jdbc namespace with embedded-database tag (supporting HSQL, H2, and Derby)
* Hibernate AnnotationSessionFactoryBean detects Hibernate's special @Entity annotation too
* added SimpleJaxWsServiceExporter workaround for WebLogic 10.3's address format requirements
* added support for @WebServiceProvider annotation to Spring's JaxWsServiceExporters
* updated Hessian support for Hessian 3.2 compatibility (requiring Hessian 3.2 or above now)
* updated Tiles support for Tiles 2.1 compatibility (requiring Tiles 2.1.2 or above now)
* Velocity/FreeMarker/TilesViewResolver only returns a view if the target resource exists now
* @DirtiesContext is now supported at the test class level with configurable class modes
* added beforeTestClass() and afterTestClass() to the TestExecutionListener API
* ProfileValueUtils now enforces class-level overrides for @IfProfileValue
* @ContextConfiguration's loader attribute is now inherited if not declared locally
* TransactionalTestExecutionListener no longer flushes transactions before rolling back
Changes in version 3.0.0.M3 (2009-05-06)
----------------------------------------
* Spring 3.0 includes reference documentation now
* Spring 3.0 is shipping with proper Maven POMs now
* updated to JRuby 1.2 (remaining compatible with JRuby 1.1 and above)
* updated to Hessian 3.2.1 (remaining compatible with Hessian 3.1.3 and above)
* updated to FreeMarker 2.3.15 (for exposure of FreeMarkerServlet-style HTTP scopes)
* removed Axis 1.x support package, keeping basic JAX-RPC support only (next to JAX-WS)
* introduced explicit XML array element in spring-beans-3.0.xsd
* introduced new type conversion SPI and converter API in spring-core convert package
* introduced annotated @Bean factory methods and JavaConfig-style @Configuration classes
* introduced @Primary, @Lazy and @DependsOn annotations for scanned components
* custom stereotype annotations can be meta-annotated with @Service, @Controller etc as well
* @Scope and @Transactional are now supported as meta-annotations on custom annotations
* @Autowired uses field/parameter name as fallback qualifier value
* qualifier annotations can be used at method level as well (applying to all parameters)
* @Value annotation can be used at method level as well (e.g. on bean property setters)
* @Value values may use ${...} placeholders (driven by PropertyPlaceholderConfigurer)
* @Resource names may use ${...} placeholders (driven by PropertyPlaceholderConfigurer)
* fixed EL evaluation of prepared constructor arguments for repeated prototype creation
* ConstructorArgumentValues exposed indexed arguments in the order of definition
* AutowiredAnnotationBeanPostProcessor calculates cached arguments in a synchronized block
* declarative destroy-method="..." specifications get validated at bean creation time
* component-scan's "base-package" attribute supports spaces as separators as well
* CachedIntrospectionResults always caches bean classes except in case of custom BeanInfo
* GenericTypeResolver's type variable cache uses weak values (for OSGi compatibility)
* fixed CachingMapDecorator to support garbage-collected weak references (again)
* AOP ProxyFactory excludes non-public interfaces when autodetecting proxy interfaces
* added DuplicateKeyException to DAO exception hierachy
* added EmbeddedDatabase support in spring-jdbc embedded package, with initial HSQL support
* SessionAwareMessageListener supports generic declaration of concrete JMS Message type
* RmiServiceExporter and RmiRegistryFactoryBean synchronize registry lookup/creation
* added "unregisterManagedResource" method to MBeanExporter/MBeanExportOperations
* TimerTaskExecutor creates non-daemon Timer and uses bean name as default Timer name
* added TaskScheduler interface and Trigger abstraction
* added ConcurrentTaskScheduler and ThreadPoolTaskScheduler
* added CommonJ TimerManagerTaskScheduler
* added CronTrigger implementation for cron expression support
* renamed "contextProperties" attribute to "contextParameters" (matching web.xml naming)
* "contextParameters" contains Servlet/PortletConfig parameters as well
* added default "servletContext" and "servletConfig" environment beans
* added default "portletContext" and "portletConfig" environment beans
* added default web scope "application", wrapping a ServletContext/PortletContext
* JSF FacesContext and ExternalContext are resolvable dependencies by default, if available
* FacesRequestAttributes (as used by RequestContextHolder) can access global Portlet session
* revised @RequestMapping semantics for REST support purposes
* request handler methods with @ModelAttribute annotation always return a model attribute
* introduced @ExceptionHandler annotation for used in annotated web controllers
* introduced ModelAndViewResolver SPI for custom handler method return types
* FreeMarkerView can be initialized with ServletContext only (e.g. for testing)
* MockPortletSession supports destruction of session attributes on invalidation
* completed upgrade of the TestContext Framework to JUnit 4.5
* SpringJUnit4ClassRunner subclasses can now override the default ContextLoader class
* added "value" alias for @ContextConfiguration's "locations" attribute
Changes in version 3.0.0.M2 (2009-02-25)
----------------------------------------
* revised expression parser API design
* added SimpleThreadScope implementation
* refined OSGi version constraints for "javax.annotation" and "junit.framework"
* "systemProperties" bean is not considered a default match for type Properties anymore
* SimpleAliasRegistry's "getAliases" method returns transitive aliases now
* SimpleAliasRegistry detects resolved aliases that loop back to the original name
* PropertyPlaceholderConfigurer does not modify Map in case of equal String keys
* improved NoClassDefFoundError handling during constructor resolution
* inner class names in Java source style ("java.lang.Thread.State") supported as well
* pre-converted property values are preserved more eagerly for re-created beans
* prototype beans receive independent collection/array even when based on single value
* registered plain singletons will be fully matched according to their qualifiers
* @Qualifier value matching takes chained aliases of target beans into account as well
* ASM-based AnnotationMetadata fully resolves class arguments and enums into Java types
* ProceedingJoinPoint resolves parameter names using ASM-based parameter name discovery
* MethodInvocations and ProceedingJoinPoints always expose original method (not bridge)
* bridge method resolution works with Hibernate-generated CGLIB proxies as well
* generic collection type resolution respects upper bound (e.g. ? extends Number) as well
* TypeUtils detects variations of ParameterizedType/GenericArrayType assignability as well
* ReflectionUtils findMethod detects methods on "java.lang.Object" as well
* UrlResource eagerly closes HTTP connections in case of "getInputStream()" failure
* PathMatchingResourcePatternResolver avoids NPE when initialized with null ClassLoader
* all "taskExecutor" bean properties now accept any "java.util.concurrent.Executor"
* added "Future submit(Runnable)" and "Future submit(Callable)" to AsyncTaskExecutor
* SimpleAsyncTaskExecutor supports a custom "java.util.concurrent.ThreadFactory"
* SchedulingTaskExecutor interface extends AsyncTaskExecutor now
* added ThreadPoolExecutorFactoryBean (exposing the native ExecutorService interface)
* added ExecutorServiceAdapter class as a standard wrapper for a Spring TaskExecutor
* reduced backport-concurrent support to TaskExecutor adapters
* added @Async annotation and AsyncAnnotationAdvisor (namespace support coming in M3)
* EJB 3.1's @Asynchronous annotation gets detected and supported by default as well
* ApplicationListener beans get obtained on demand, supporting non-singletons as well
* ApplicationListeners will be called in the order according to the Ordered contract
* generified ApplicationListener interface, narrowing the event type to be received
* introduced SmartApplicationListener interface for supported event/source types
* generified Transaction/Hibernate/Jdo/JpaCallback with generic "doInXxx" return type
* HibernateOperations uses generic parameter/return types where possible
* JdoOperations uses generic parameter/return types where possible (following JDO 2.1)
* removed "flush" operation from JdoDialect (fully relying on JDO 2.0+ compliance now)
* added JDO 2.1 compliant StandardPersistenceManagerProxy/SpringPersistenceManagerProxy
* Spring-created EntityManagers support JPA 2.0 draft API ("unwrap", "getQueryBuilder")
* Spring initiates JPA 2.0 query timeout with remaining Spring transaction timeout
* added support for WebSphere's ResourceAdapter-managed messaging transactions
* made SpringBeanAutowiringInterceptor callback signature compatible with WebSphere
* WebSphereUowTransactionManager preserves original exception in case of rollback
* added "flush()" method to TransactionStatus and TransactionSynchronization interfaces
* test context manager automatically flushes transactions before rolling back
* DefaultLobHandler uses explicit Blob/Clob access for reading when "wrapAsLob"=true
* fixed JmsException/JmsUtils to fully avoid NPEs in case of cause messages being null
* fixed MessageListenerAdapter's "getSubscriptionName()" to work without delegate as well
* fixed HTTP invoker to support resolution of multi-level primitive array classes again
* deprecated support for JMS 1.0.2 providers (JmsTemplate102 etc)
* introduced top-level HTTP support package "org.springframework.http"
* introduced RestTemplate facility in package "org.springframework.web.client"
* introduced OXM support package (originating from Spring Web Services)
* introduced OXM-based MarshallingMessageConverter for Spring JMS
* introduced OXM-based MarshallingView for Spring MVC
* refined @PathVariable handling in MVC handler methods
* updated Spring Portlet MVC infrastructure and mocks for Portlet API 2.0
* added resource and event methods to Portlet HandlerAdapter/HandlerInterceptor
* added resolveException method for resource requests to HandlerExceptionResolver
* introduced Resource/EventAwareController subinterfaces of Portlet Controller
* introduced @Action/@Render/@Resource/@EventMapping annotations for Portlet MVC
* added @RequestHeader support for Portlet MVC (based on Portlet request properties)
* introduced @CookieValue annotation for Servlet and Portlet MVC handler methods
* @RequestMapping type-level param constraints taken into account consistently
* optional boolean parameters in MVC handler methods resolve to "false" if not present
* "url" macro in "spring.ftl" performs standard Servlet URL encoding automatically
Changes in version 3.0.0.M1 (2008-12-05)
----------------------------------------
* revised project layout and build system (module-based sources, bundle repository)
* updated entire codebase for Java 5 code style (generics, varargs, StringBuilder)
* updated to JUnit 4.5 and JRuby 1.1
* removed WebLogic 8.1 and WebSphere 5.1 support
* removed native TopLink API support (superseded by JPA)
* removed Commons Attributes support (superseded by Java 5 annotations)
* removed Jakarta JSTL support for JSP 1.2 (superseded by JSP 2.0)
* removed outdated Struts 1.x Action delegation support
* removed ContextLoaderServlet and Log4jConfigServlet
* deprecated form controller hierarchy in favor of @MVC form object handling
* deprecated JUnit 3.8 test class hierarchy in favor of test context framework
* revised TaskExecutor interface to extend "java.util.concurrent.Executor" now
* introduced Spring EL parser in org.springframework.expression package
* introduced #{...} expression support in bean definitions
* introduced @Value annotation for embedded expression support
* introduced @PathVariable annotation for MVC handler methods
* introduced ShallowEtagHeaderFilter
* introduced AbstractAtomFeedView and AbstractRssFeedView
* introduced default value support for @RequestParam
* introduced @RequestHeader annotation for MVC handler methods
* introduced "spring:url" and "spring:param" JSP tags
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,22 @@
======================================================================
== NOTICE file corresponding to section 4 d of the Apache License, ==
== Version 2.0, for the Spring Framework distribution. ==
======================================================================
This product includes software developed by
the Apache Software Foundation (http://www.apache.org).
The end-user documentation included with a redistribution, if any,
must include the following acknowledgement:
"This product includes software developed by the Spring Framework
Project (http://www.springframework.org)."
Alternately, this acknowledgement may appear in the software itself,
if and wherever such third-party acknowledgements normally appear.
The names "Spring", "Spring Framework", and "Spring Web Flow" must
not be used to endorse or promote products derived from this
software without prior written permission. For written permission,
please contact enquiries@springsource.com.
@@ -0,0 +1,27 @@
SPRING FRAMEWORK 3.0.7 (December 2011)
--------------------------------------
http://www.springsource.org
1. INTRODUCTION
Spring Framework 3.0 is the next generation of Spring: fully Java 5 based,
EL enabled, REST enabled, and with support for JSR-330 (Dependency
Injection) and JSR-303 (Bean Validation).
2. RELEASE NOTES
This release comes with complete reference documentation. For further
details, consult the provided javadoc for specific packages and classes.
3. DISTRIBUTION JAR FILES
The Spring Framework module jar files can be found in the 'dist'
directory. Note that this release does not contain a 'spring.jar' file
anymore, in contrast to previous Spring generations. Furthermore, the jar
file names now follow bundle repository conventions.
4. GETTING STARTED
Please consult the blog examples at http://blog.springsource.com as well
as sections of interest in the reference documentation. Sample
applications and related material are provided as separate downloads.
-443
View File
@@ -1,443 +0,0 @@
plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'io.spring.nohttp' version '0.0.10'
id 'io.freefair.aspectj' version '6.2.0' apply false
id 'org.jetbrains.dokka' version '1.6.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.5.32' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version "1.5.32" apply false
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.unbroken-dome.xjc' version '2.0.0' apply false
id 'com.github.ben-manes.versions' version '0.39.0'
id 'com.github.johnrengelman.shadow' version '7.0.0' apply false
id 'de.undercouch.download' version '4.1.2'
id 'me.champeau.jmh' version "0.6.6" apply false
}
ext {
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
javaProjects = subprojects - project(":framework-bom")
withoutJclOverSlf4j = {
exclude group: "org.slf4j", name: "jcl-over-slf4j"
}
}
configure(allprojects) { project ->
apply plugin: "io.spring.dependency-management"
dependencyManagement {
imports {
mavenBom "com.fasterxml.jackson:jackson-bom:2.12.7"
mavenBom "io.netty:netty-bom:4.1.107.Final"
mavenBom "io.projectreactor:reactor-bom:2020.0.41"
mavenBom "io.r2dbc:r2dbc-bom:Arabba-SR13"
mavenBom "io.rsocket:rsocket-bom:1.1.3"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.54.v20240208"
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.5.32"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.5.2"
mavenBom "org.jetbrains.kotlinx:kotlinx-serialization-bom:1.2.2"
mavenBom "org.junit:junit-bom:5.8.2"
}
dependencies {
dependencySet(group: 'org.apache.logging.log4j', version: '2.21.1') {
entry 'log4j-api'
entry 'log4j-core'
entry 'log4j-jul'
entry 'log4j-slf4j-impl'
}
dependency "org.slf4j:slf4j-api:1.7.36"
dependency("com.google.code.findbugs:findbugs:3.0.1") {
exclude group: "dom4j", name: "dom4j"
}
dependency "com.google.code.findbugs:jsr305:3.0.2"
dependencySet(group: 'org.aspectj', version: '1.9.7') {
entry 'aspectjrt'
entry 'aspectjtools'
entry 'aspectjweaver'
}
dependencySet(group: 'org.codehaus.groovy', version: '3.0.9') {
entry 'groovy'
entry 'groovy-jsr223'
entry 'groovy-templates' // requires findbugs for warning-free compilation
entry 'groovy-test'
entry 'groovy-xml'
}
dependency "io.reactivex:rxjava:1.3.8"
dependency "io.reactivex:rxjava-reactive-streams:1.2.1"
dependency "io.reactivex.rxjava2:rxjava:2.2.21"
dependency "io.reactivex.rxjava3:rxjava:3.1.8"
dependency "io.smallrye.reactive:mutiny:1.9.0"
dependency "io.projectreactor.tools:blockhound:1.0.8.RELEASE"
dependency "com.caucho:hessian:4.0.63"
dependency "com.fasterxml:aalto-xml:1.3.1"
dependency("com.fasterxml.woodstox:woodstox-core:6.2.8") {
exclude group: "stax", name: "stax-api"
}
dependency "com.google.code.gson:gson:2.8.9"
dependency "com.google.protobuf:protobuf-java-util:3.19.3"
dependency "com.googlecode.protobuf-java-format:protobuf-java-format:1.4"
dependency("com.thoughtworks.xstream:xstream:1.4.19") {
exclude group: "xpp3", name: "xpp3_min"
exclude group: "xmlpull", name: "xmlpull"
}
dependency "org.apache.johnzon:johnzon-jsonb:1.2.18"
dependency("org.codehaus.jettison:jettison:1.3.8") {
exclude group: "stax", name: "stax-api"
}
dependencySet(group: 'org.jibx', version: '1.3.3') {
entry 'jibx-bind'
entry 'jibx-run'
}
dependency "org.ogce:xpp3:1.1.6"
dependency "org.yaml:snakeyaml:1.33"
dependency "com.h2database:h2:2.1.214"
dependency "com.github.ben-manes.caffeine:caffeine:2.9.3"
dependency "com.github.librepdf:openpdf:1.3.33"
dependency "com.rometools:rome:1.18.0"
dependency "commons-io:commons-io:2.5"
dependency "io.vavr:vavr:0.10.4"
dependency "net.sf.jopt-simple:jopt-simple:5.0.4"
dependencySet(group: 'org.apache.activemq', version: '5.16.2') {
entry 'activemq-broker'
entry('activemq-kahadb-store') {
exclude group: "org.springframework", name: "spring-context"
}
entry 'activemq-stomp'
}
dependency "org.apache.bcel:bcel:6.0"
dependency "org.apache.commons:commons-pool2:2.9.0"
dependencySet(group: 'org.apache.derby', version: '10.14.2.0') {
entry 'derby'
entry 'derbyclient'
}
dependency "org.apache.poi:poi-ooxml:4.1.2"
dependency "org.apache-extras.beanshell:bsh:2.0b6"
dependency "org.freemarker:freemarker:2.3.31"
dependency "org.hsqldb:hsqldb:2.5.2"
dependency "org.quartz-scheduler:quartz:2.3.2"
dependency "org.codehaus.fabric3.api:commonj:1.1.0"
dependency "net.sf.ehcache:ehcache:2.10.6"
dependency "org.ehcache:jcache:1.0.1"
dependency "org.ehcache:ehcache:3.4.0"
dependency "org.hibernate:hibernate-core:5.4.33.Final"
dependency "org.hibernate:hibernate-validator:6.2.5.Final"
dependency "org.webjars:webjars-locator-core:0.48"
dependency "org.webjars:underscorejs:1.8.3"
dependencySet(group: 'org.apache.tomcat', version: '9.0.82') {
entry 'tomcat-util'
entry('tomcat-websocket') {
exclude group: "org.apache.tomcat", name: "tomcat-servlet-api"
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
}
}
dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.82') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-websocket'
}
dependencySet(group: 'io.undertow', version: '2.2.29.Final') {
entry 'undertow-core'
entry('undertow-servlet') {
exclude group: "org.jboss.spec.javax.servlet", name: "jboss-servlet-api_4.0_spec"
exclude group: "org.jboss.spec.javax.annotation", name: "jboss-annotations-api_1.3_spec"
}
entry('undertow-websockets-jsr') {
exclude group: "org.jboss.spec.javax.websocket", name: "jboss-websocket-api_1.1_spec"
}
}
dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.13"
dependency 'org.apache.httpcomponents.client5:httpclient5:5.1.3'
dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.3'
dependency("org.apache.httpcomponents:httpclient:4.5.13") {
exclude group: "commons-logging", name: "commons-logging"
}
dependency("org.apache.httpcomponents:httpasyncclient:4.1.5") {
exclude group: "commons-logging", name: "commons-logging"
}
dependencySet(group: 'com.squareup.okhttp3', version: '3.14.9') {
entry 'okhttp'
entry 'mockwebserver'
}
dependency "org.jruby:jruby:9.2.20.1"
dependency "org.python:jython-standalone:2.7.1"
dependency "org.mozilla:rhino:1.7.11"
dependency "commons-fileupload:commons-fileupload:1.4"
dependency "org.synchronoss.cloud:nio-multipart-parser:1.1.0"
dependency("org.dom4j:dom4j:2.1.3") {
exclude group: "jaxen", name: "jaxen"
exclude group: "net.java.dev.msv", name: "xsdlib"
exclude group: "pull-parser", name: "pull-parser"
exclude group: "xpp3", name: "xpp3"
}
dependency("jaxen:jaxen:1.2.0") {
exclude group: "dom4j", name: "dom4j"
}
dependency("junit:junit:4.13.2") {
exclude group: "org.hamcrest", name: "hamcrest-core"
}
dependency("de.bechte.junit:junit-hierarchicalcontextrunner:4.12.1") {
exclude group: "junit", name: "junit"
}
dependency "org.testng:testng:7.4.0"
dependency "org.junit.support:testng-engine:1.0.4"
dependency "org.hamcrest:hamcrest:2.2"
dependency "org.awaitility:awaitility:3.1.6"
dependency "org.assertj:assertj-core:3.24.2"
dependencySet(group: 'org.xmlunit', version: '2.9.0') {
entry 'xmlunit-assertj'
entry('xmlunit-matchers') {
exclude group: "org.hamcrest", name: "hamcrest-core"
}
}
dependencySet(group: 'org.mockito', version: '4.9.0') { // spring-beans tests fail with 4.10+
entry('mockito-core') {
exclude group: "org.hamcrest", name: "hamcrest-core"
}
entry 'mockito-junit-jupiter'
}
dependency "io.mockk:mockk:1.12.1"
dependency("net.sourceforge.htmlunit:htmlunit:2.70.0") {
exclude group: "commons-logging", name: "commons-logging"
}
dependency("org.seleniumhq.selenium:htmlunit-driver:2.70.0") {
exclude group: "commons-logging", name: "commons-logging"
}
dependency("org.seleniumhq.selenium:selenium-java:3.141.59") {
exclude group: "commons-logging", name: "commons-logging"
exclude group: "io.netty", name: "netty"
}
dependency "org.skyscreamer:jsonassert:1.5.0"
dependency "com.jayway.jsonpath:json-path:2.7.0"
dependency "org.bouncycastle:bcpkix-jdk18on:1.71"
dependencySet(group: 'org.apache.tiles', version: '3.0.8') {
entry 'tiles-api'
entry('tiles-core', withoutJclOverSlf4j)
entry('tiles-servlet', withoutJclOverSlf4j)
entry('tiles-jsp', withoutJclOverSlf4j)
entry('tiles-el', withoutJclOverSlf4j)
entry('tiles-extras') {
exclude group: "org.springframework", name: "spring-web"
exclude group: "org.slf4j", name: "jcl-over-slf4j"
}
}
dependency("org.apache.taglibs:taglibs-standard-jstlel:1.2.5") {
exclude group: "org.apache.taglibs", name: "taglibs-standard-spec"
}
dependency "com.ibm.websphere:uow:6.0.2.17"
dependency "com.jamonapi:jamon:2.82"
dependency "joda-time:joda-time:2.10.13"
dependency "org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.12"
dependency "org.javamoney:moneta:1.3"
dependency "com.sun.activation:javax.activation:1.2.0"
dependency "com.sun.mail:javax.mail:1.6.2"
dependencySet(group: 'com.sun.xml.bind', version: '2.3.0.1') {
entry 'jaxb-core'
entry 'jaxb-impl'
entry 'jaxb-xjc'
}
dependency "javax.activation:javax.activation-api:1.2.0"
dependency "javax.annotation:javax.annotation-api:1.3.2"
dependency "javax.cache:cache-api:1.1.0"
dependency "javax.ejb:javax.ejb-api:3.2"
dependency "javax.el:javax.el-api:3.0.1-b04"
dependency "javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0"
dependency "javax.faces:javax.faces-api:2.2"
dependency "javax.inject:javax.inject:1"
dependency "javax.inject:javax.inject-tck:1"
dependency "javax.interceptor:javax.interceptor-api:1.2.2"
dependency "javax.jms:javax.jms-api:2.0.1"
dependency "javax.json:javax.json-api:1.1.4"
dependency "javax.json.bind:javax.json.bind-api:1.0"
dependency "javax.mail:javax.mail-api:1.6.2"
dependency "javax.money:money-api:1.0.3"
dependency "javax.resource:javax.resource-api:1.7.1"
dependency "javax.servlet:javax.servlet-api:4.0.1"
dependency "javax.servlet.jsp:javax.servlet.jsp-api:2.3.2-b02"
dependency "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1"
dependency "javax.transaction:javax.transaction-api:1.3"
dependency "javax.validation:validation-api:2.0.1.Final"
dependency "javax.websocket:javax.websocket-api:1.1"
dependency "javax.xml.bind:jaxb-api:2.3.1"
dependency "javax.xml.ws:jaxws-api:2.3.1"
dependency "org.eclipse.persistence:javax.persistence:2.2.0"
// Substitute for "javax.management:jmxremote_optional:1.0.1_04" which
// is not available on Maven Central
dependency "org.glassfish.external:opendmk_jmxremote_optional_jar:1.0-b01-ea"
dependency "org.glassfish:javax.el:3.0.1-b08"
dependency "org.glassfish.main:javax.jws:4.0-b33"
dependency "org.glassfish.tyrus:tyrus-container-servlet:1.13.1"
}
generatedPomCustomization {
enabled = false
}
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/libs-spring-framework-build" }
}
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
cacheDynamicVersionsFor 0, "seconds"
}
}
}
configure([rootProject] + javaProjects) { project ->
group = "org.springframework"
apply plugin: "java"
apply plugin: "java-test-fixtures"
apply plugin: "checkstyle"
apply plugin: 'org.springframework.build.compile'
apply from: "${rootDir}/gradle/toolchains.gradle"
apply from: "${rootDir}/gradle/ide.gradle"
pluginManager.withPlugin("kotlin") {
apply plugin: "org.jetbrains.dokka"
apply from: "${rootDir}/gradle/docs-dokka.gradle"
compileKotlin {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
freeCompilerArgs = ["-Xjsr305=strict", "-Xsuppress-version-warnings", "-Xopt-in=kotlin.RequiresOptIn"]
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
}
}
}
test {
useJUnitPlatform()
include(["**/*Tests.class", "**/*Test.class"])
systemProperty("java.awt.headless", "true")
systemProperty("testGroups", project.properties.get("testGroups"))
systemProperty("io.netty.leakDetection.level", "paranoid")
}
checkstyle {
toolVersion = "10.12.7"
configDirectory.set(rootProject.file("src/checkstyle"))
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.junit.platform:junit-platform-suite-api")
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("io.mockk:mockk")
testImplementation("org.assertj:assertj-core")
// Pull in the latest JUnit 5 Launcher API to ensure proper support in IDEs.
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.junit.platform:junit-platform-suite-engine")
testRuntimeOnly("org.apache.logging.log4j:log4j-core")
testRuntimeOnly("org.apache.logging.log4j:log4j-jul")
testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
// JSR-305 only used for non-required meta-annotations
compileOnly("com.google.code.findbugs:jsr305")
testCompileOnly("com.google.code.findbugs:jsr305")
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.41")
}
ext.javadocLinks = [
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.oracle.com/javaee/7/api/",
"https://docs.oracle.com/cd/E13222_01/wls/docs90/javadocs/", // CommonJ
"https://www.ibm.com/docs/api/v1/content/SSEQTP_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/",
"https://docs.jboss.org/jbossas/javadoc/4.0.5/connector/",
"https://docs.jboss.org/jbossas/javadoc/7.1.2.Final/",
"https://tiles.apache.org/tiles-request/apidocs/",
"https://tiles.apache.org/framework/apidocs/",
"https://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
"https://www.ehcache.org/apidocs/2.10.4/",
"https://www.quartz-scheduler.org/api/2.3.0/",
"https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.12.7/",
"https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.12.7/",
"https://www.javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.12.7/",
"https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/",
"https://projectreactor.io/docs/test/release/api/",
"https://junit.org/junit4/javadoc/4.13.2/",
// Disabling linking to JUnit 5.8.2, since the `package-list` file no longer exists due to
// https://github.com/junit-team/junit5/commit/67ad4e545518b0ce2b0e7c96df31a669866d5003.
// "https://junit.org/junit5/docs/5.8.2/api/",
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
"https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/",
"https://r2dbc.io/spec/0.8.5.RELEASE/api/",
// The external Javadoc link for JSR 305 must come last to ensure that types from
// JSR 250 (such as @PostConstruct) are still supported. This is due to the fact
// that JSR 250 and JSR 305 both define types in javax.annotation, which results
// in a split package, and the javadoc tool does not support split packages
// across multiple external Javadoc sites.
"https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/"
] as String[]
}
configure(moduleProjects) { project ->
apply from: "${rootDir}/gradle/spring-module.gradle"
}
configure(rootProject) {
description = "Spring Framework"
apply plugin: "kotlin"
apply plugin: "io.spring.nohttp"
apply plugin: 'org.springframework.build.api-diff'
apply from: "${rootDir}/gradle/publications.gradle"
apply from: "${rootDir}/gradle/docs.gradle"
nohttp {
source.exclude "**/test-output/**"
allowlistFile = project.file("src/nohttp/allowlist.lines")
def rootPath = file(rootDir).toPath()
def projectDirs = allprojects.collect { it.projectDir } + "${rootDir}/spring-core-test" + "${rootDir}/buildSrc" + "${rootDir}/framework-docs"
projectDirs.forEach { dir ->
[ 'bin', 'build', 'out', '.settings' ]
.collect { rootPath.relativize(new File(dir, it).toPath()) }
.forEach { source.exclude "$it/**" }
[ '.classpath', '.project' ]
.collect { rootPath.relativize(new File(dir, it).toPath()) }
.forEach { source.exclude "$it" }
}
}
tasks.named("checkstyleNohttp").configure {
maxHeapSize = "1g"
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact docsZip
artifact schemaZip
artifact distZip
}
}
}
}
+30
View File
@@ -0,0 +1,30 @@
version=3.0.8
# osgi ranges
spring.osgi.range.nq=${version:[=.=.=, =.=.+1)}
spring.osgi.range="${spring.osgi.range.nq}"
aj.osgi.range="[1.5.4, 2.0.0)"
#
#release.type=integration
natural.name=spring-framework
project.name=Spring Framework
project.key=SPR
ivy.cache.dir=${basedir}/../ivy-cache
integration.repo.dir=${basedir}/../integration-repo
license.dir=${basedir}/../build-spring-framework/resources
javadoc.exclude.package.names=org/springframework/samples/**
javadoc.max.memory=256M
test.vm.args=-Xmx1024M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError
compiler.args=-enableJavadoc -warn:none
# For when releasing
#release.type=release
#build.stamp=RELEASE
# For when releasing milestones
#release.type=milestone
#build.stamp=M1
# For development in trunk
release.type=integration
build.stamp=BUILD-SNAPSHOT
+5
View File
@@ -0,0 +1,5 @@
#common dependency versions
aspectj.version=1.6.8.RELEASE
slf4j.version=1.5.3
junit.version=4.7.0
testng.version=5.10.0
-35
View File
@@ -1,35 +0,0 @@
# Spring Framework Build
This folder contains the custom plugins and conventions for the Spring Framework build.
They are declared in the `build.gradle` file in this folder.
## Build Conventions
### Compiler conventions
The `org.springframework.build.compile` plugin applies the Java compiler conventions to the build.
## Build Plugins
### Optional dependencies
The `org.springframework.build.optional-dependencies` plugin creates a new `optional`
Gradle configuration - it adds the dependencies to the project's compile and runtime classpath
but doesn't affect the classpath of dependent projects.
This plugin does not provide a `provided` configuration, as the native `compileOnly` and `testCompileOnly`
configurations are preferred.
### API Diff
This plugin uses the [Gradle JApiCmp](https://github.com/melix/japicmp-gradle-plugin) plugin
to generate API Diff reports for each Spring Framework module. This plugin is applied once on the root
project and creates tasks in each framework module. Unlike previous versions of this part of the build,
there is no need for checking out a specific tag. The plugin will fetch the JARs we want to compare the
current working version with. You can generate the reports for all modules or a single module:
```
./gradlew apiDiff -PbaselineVersion=5.1.0.RELEASE
./gradlew :spring-core:apiDiff -PbaselineVersion=5.1.0.RELEASE
```
The reports are located under `build/reports/api-diff/$OLDVERSION_to_$NEWVERSION/`.
-29
View File
@@ -1,29 +0,0 @@
plugins {
id 'java-gradle-plugin'
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation "me.champeau.gradle:japicmp-gradle-plugin:0.3.0"
}
gradlePlugin {
plugins {
apiDiffPlugin {
id = "org.springframework.build.api-diff"
implementationClass = "org.springframework.build.api.ApiDiffPlugin"
}
compileConventionsPlugin {
id = "org.springframework.build.compile"
implementationClass = "org.springframework.build.compile.CompilerConventionsPlugin"
}
optionalDependenciesPlugin {
id = "org.springframework.build.optional-dependencies"
implementationClass = "org.springframework.build.optional.OptionalDependenciesPlugin"
}
}
}
-1
View File
@@ -1 +0,0 @@
org.gradle.caching=true
@@ -1,115 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.build.api;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;
import me.champeau.gradle.japicmp.JapicmpPlugin;
import me.champeau.gradle.japicmp.JapicmpTask;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.jvm.tasks.Jar;
/**
* {@link Plugin} that applies the {@code "japicmp-gradle-plugin"}
* and create tasks for all subprojects, diffing the public API one by one
* and creating the reports in {@code "build/reports/api-diff/$OLDVERSION_to_$NEWVERSION/"}.
* <p>{@code "./gradlew apiDiff -PbaselineVersion=5.1.0.RELEASE"} will output the
* reports for the API diff between the baseline version and the current one for all modules.
* You can limit the report to a single module with
* {@code "./gradlew :spring-core:apiDiff -PbaselineVersion=5.1.0.RELEASE"}.
*
* @author Brian Clozel
*/
public class ApiDiffPlugin implements Plugin<Project> {
public static final String TASK_NAME = "apiDiff";
private static final String BASELINE_VERSION_PROPERTY = "baselineVersion";
private static final List<String> PACKAGE_INCLUDES = Collections.singletonList("org.springframework.*");
@Override
public void apply(Project project) {
if (project.hasProperty(BASELINE_VERSION_PROPERTY) && project.equals(project.getRootProject())) {
project.getPluginManager().apply(JapicmpPlugin.class);
project.getPlugins().withType(JapicmpPlugin.class,
plugin -> applyApiDiffConventions(project));
}
}
private void applyApiDiffConventions(Project project) {
String baselineVersion = project.property(BASELINE_VERSION_PROPERTY).toString();
project.subprojects(subProject -> createApiDiffTask(baselineVersion, subProject));
}
private void createApiDiffTask(String baselineVersion, Project project) {
if (isProjectEligible(project)) {
JapicmpTask apiDiff = project.getTasks().create(TASK_NAME, JapicmpTask.class);
apiDiff.setDescription("Generates an API diff report with japicmp");
apiDiff.setGroup(JavaBasePlugin.DOCUMENTATION_GROUP);
apiDiff.setOldClasspath(project.files(createBaselineConfiguration(baselineVersion, project)));
TaskProvider<Jar> jar = project.getTasks().withType(Jar.class).named("jar");
apiDiff.setNewArchives(project.getLayout().files(jar.get().getArchiveFile().get().getAsFile()));
apiDiff.setNewClasspath(getRuntimeClassPath(project));
apiDiff.setPackageIncludes(PACKAGE_INCLUDES);
apiDiff.setOnlyModified(true);
apiDiff.setIgnoreMissingClasses(true);
// Ignore Kotlin metadata annotations since they contain
// illegal HTML characters and fail the report generation
apiDiff.setAnnotationExcludes(Collections.singletonList("@kotlin.Metadata"));
apiDiff.setHtmlOutputFile(getOutputFile(baselineVersion, project));
apiDiff.dependsOn(project.getTasks().getByName("jar"));
}
}
private boolean isProjectEligible(Project project) {
return project.getPlugins().hasPlugin(JavaPlugin.class)
&& project.getPlugins().hasPlugin(MavenPublishPlugin.class);
}
private Configuration createBaselineConfiguration(String baselineVersion, Project project) {
String baseline = String.join(":",
project.getGroup().toString(), project.getName(), baselineVersion);
Dependency baselineDependency = project.getDependencies().create(baseline + "@jar");
return project.getRootProject().getConfigurations().detachedConfiguration(baselineDependency);
}
private Configuration getRuntimeClassPath(Project project) {
return project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
}
private File getOutputFile(String baseLineVersion, Project project) {
Path outDir = Paths.get(project.getRootProject().getBuildDir().getAbsolutePath(),
"reports", "api-diff",
baseLineVersion + "_to_" + project.getRootProject().getVersion());
return project.file(outDir.resolve(project.getName() + ".html").toString());
}
}
@@ -1,89 +0,0 @@
/*
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.build.compile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.compile.JavaCompile;
/**
* {@link Plugin} that applies conventions for compiling Java sources in Spring Framework.
*
* @author Brian Clozel
* @author Sam Brannen
* @author Sebastien Deleuze
*/
public class CompilerConventionsPlugin implements Plugin<Project> {
private static final List<String> COMPILER_ARGS;
private static final List<String> TEST_COMPILER_ARGS;
static {
List<String> commonCompilerArgs = Arrays.asList(
"-Xlint:serial", "-Xlint:cast", "-Xlint:classfile", "-Xlint:dep-ann",
"-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
"-Xlint:path", "-Xlint:processing", "-Xlint:static", "-Xlint:try", "-Xlint:-options",
"-parameters"
);
COMPILER_ARGS = new ArrayList<>();
COMPILER_ARGS.addAll(commonCompilerArgs);
COMPILER_ARGS.addAll(Arrays.asList(
"-Xlint:varargs", "-Xlint:fallthrough", "-Xlint:rawtypes", "-Xlint:deprecation",
"-Xlint:unchecked", "-Werror"
));
TEST_COMPILER_ARGS = new ArrayList<>();
TEST_COMPILER_ARGS.addAll(commonCompilerArgs);
TEST_COMPILER_ARGS.addAll(Arrays.asList("-Xlint:-varargs", "-Xlint:-fallthrough", "-Xlint:-rawtypes",
"-Xlint:-deprecation", "-Xlint:-unchecked"));
}
@Override
public void apply(Project project) {
project.getPlugins().withType(JavaLibraryPlugin.class, javaPlugin -> applyJavaCompileConventions(project));
}
/**
* Applies the common Java compiler options for main sources, test fixture sources, and
* test sources.
* @param project the current project
*/
private void applyJavaCompileConventions(Project project) {
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
project.getTasks().withType(JavaCompile.class)
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_JAVA_TASK_NAME))
.forEach(compileTask -> {
compileTask.getOptions().setCompilerArgs(COMPILER_ARGS);
compileTask.getOptions().setEncoding("UTF-8");
});
project.getTasks().withType(JavaCompile.class)
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME)
|| compileTask.getName().equals("compileTestFixturesJava"))
.forEach(compileTask -> {
compileTask.getOptions().setCompilerArgs(TEST_COMPILER_ARGS);
compileTask.getOptions().setEncoding("UTF-8");
});
}
}
@@ -1,59 +0,0 @@
/*
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.build.optional;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.attributes.Usage;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.plugins.ide.eclipse.EclipsePlugin;
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
/**
* A {@code Plugin} that adds support for Maven-style optional dependencies. Creates a new
* {@code optional} configuration. The {@code optional} configuration is part of the
* project's compile and runtime classpaths but does not affect the classpath of
* dependent projects.
*
* @author Andy Wilkinson
*/
public class OptionalDependenciesPlugin implements Plugin<Project> {
/**
* Name of the {@code optional} configuration.
*/
public static final String OPTIONAL_CONFIGURATION_NAME = "optional";
@Override
public void apply(Project project) {
Configuration optional = project.getConfigurations().create("optional");
optional.setCanBeConsumed(false);
optional.setCanBeResolved(false);
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets();
sourceSets.all((sourceSet) -> {
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName()).extendsFrom(optional);
project.getConfigurations().getByName(sourceSet.getRuntimeClasspathConfigurationName()).extendsFrom(optional);
});
});
}
}
+6
View File
@@ -0,0 +1,6 @@
# properties used by Bamboo build plan at http://build.springframework.org/build/admin/buildConfiguration.action?buildKey=SPR-TRUNKQUICK
# run in conjunction with ANT_OPTS='-XX:MaxPermSize=512m -Xmx1024m'
compiler.args=-enableJavadoc -warn:none
java.awt.headless=true
ci.build=true
test.vm.args=-XX:MaxPermSize=512m -Xmx1024m
-57
View File
@@ -1,57 +0,0 @@
== Spring Framework Concourse pipeline
The Spring Framework uses https://concourse-ci.org/[Concourse] for its CI build and other automated tasks.
The Spring team has a dedicated Concourse instance available at https://ci.spring.io with a build pipeline
for https://ci.spring.io/teams/spring-framework/pipelines/spring-framework-5.3.x[Spring Framework 5.3.x].
=== Setting up your development environment
If you're part of the Spring Framework project on GitHub, you can get access to CI management features.
First, you need to go to https://ci.spring.io and install the client CLI for your platform (see bottom right of the screen).
You can then login with the instance using:
[source]
----
$ fly -t spring login -n spring-framework -c https://ci.spring.io
----
Once logged in, you should get something like:
[source]
----
$ fly ts
name url team expiry
spring https://ci.spring.io spring-framework Wed, 25 Mar 2020 17:45:26 UTC
----
=== Pipeline configuration and structure
The build pipelines are described in `pipeline.yml` file.
This file is listing Concourse resources, i.e. build inputs and outputs such as container images, artifact repositories, source repositories, notification services, etc.
It also describes jobs (a job is a sequence of inputs, tasks and outputs); jobs are organized by groups.
The `pipeline.yml` definition contains `((parameters))` which are loaded from the `parameters.yml` file or from our https://docs.cloudfoundry.org/credhub/[credhub instance].
You'll find in this folder the following resources:
* `pipeline.yml` the build pipeline
* `parameters.yml` the build parameters used for the pipeline
* `images/` holds the container images definitions used in this pipeline
* `scripts/` holds the build scripts that ship within the CI container images
* `tasks` contains the task definitions used in the main `pipeline.yml`
=== Updating the build pipeline
Updating files on the repository is not enough to update the build pipeline, as changes need to be applied.
The pipeline can be deployed using the following command:
[source]
----
$ fly -t spring set-pipeline -p spring-framework-5.3.x -c ci/pipeline.yml -l ci/parameters.yml
----
NOTE: This assumes that you have credhub integration configured with the appropriate secrets.
-20
View File
@@ -1,20 +0,0 @@
changelog:
repository: spring-projects/spring-framework
sections:
- title: ":star: New Features"
labels:
- "type: enhancement"
- title: ":lady_beetle: Bug Fixes"
labels:
- "type: bug"
- "type: regression"
- title: ":notebook_with_decorative_cover: Documentation"
labels:
- "type: documentation"
- title: ":hammer: Dependency Upgrades"
sort: "title"
labels:
- "type: dependency-upgrade"
contributors:
exclude:
names: ["bclozel", "jhoeller", "poutsma", "rstoyanchev", "sbrannen", "sdeleuze", "snicoll"]
-10
View File
@@ -1,10 +0,0 @@
logging:
level:
io.spring.concourse: DEBUG
spring:
main:
banner-mode: off
sonatype:
exclude:
- 'build-info\.json'
- '.*\.zip'
-21
View File
@@ -1,21 +0,0 @@
== CI Images
These images are used by CI to run the actual builds.
To build the image locally run the following from this directory:
----
$ docker build --no-cache -f <image-folder>/Dockerfile .
----
For example
----
$ docker build --no-cache -f spring-framework-ci-image/Dockerfile .
----
To test run:
----
$ docker run -it --entrypoint /bin/bash <SHA>
----
-10
View File
@@ -1,10 +0,0 @@
FROM ubuntu:jammy-20240111
ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
RUN ./setup.sh java8
ENV JAVA_HOME /opt/openjdk/java8
ENV JDK17 /opt/openjdk/java17
ENV PATH $JAVA_HOME/bin:$PATH
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
set -e
case "$1" in
java8)
echo "https://github.com/bell-sw/Liberica/releases/download/8u402%2B7/bellsoft-jdk8u402+7-linux-amd64.tar.gz"
;;
java17)
echo "https://github.com/bell-sw/Liberica/releases/download/17.0.10%2B13/bellsoft-jdk17.0.10+13-linux-amd64.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1
esac
-40
View File
@@ -1,40 +0,0 @@
#!/bin/bash
set -ex
###########################################################
# UTILS
###########################################################
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --no-install-recommends -y tzdata ca-certificates net-tools libxml2-utils git curl libudev1 libxml2-utils iptables iproute2 jq fontconfig
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
rm -rf /var/lib/apt/lists/*
curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/concourse-java.sh > /opt/concourse-java.sh
###########################################################
# JAVA
###########################################################
mkdir -p /opt/openjdk
pushd /opt/openjdk > /dev/null
for jdk in java8 java17
do
JDK_URL=$( /get-jdk-url.sh $jdk )
mkdir $jdk
pushd $jdk > /dev/null
curl -L ${JDK_URL} | tar zx --strip-components=1
test -f bin/java
test -f bin/javac
popd > /dev/null
done
popd
###########################################################
# GRADLE ENTERPRISE
###########################################################
cd /
mkdir ~/.gradle
echo 'systemProp.user.name=concourse' > ~/.gradle/gradle.properties
-11
View File
@@ -1,11 +0,0 @@
github-repo: "https://github.com/spring-projects/spring-framework.git"
github-repo-name: "spring-projects/spring-framework"
sonatype-staging-profile: "org.springframework"
docker-hub-organization: "springci"
artifactory-server: "https://repo.spring.io"
branch: "5.3.x"
milestone: "5.3.x"
build-name: "spring-framework"
pipeline-name: "spring-framework"
concourse-url: "https://ci.spring.io"
task-timeout: 1h00m
-399
View File
@@ -1,399 +0,0 @@
anchors:
git-repo-resource-source: &git-repo-resource-source
uri: ((github-repo))
username: ((github-username))
password: ((github-ci-release-token))
branch: ((branch))
gradle-enterprise-task-params: &gradle-enterprise-task-params
GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key))
GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username))
GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password))
sonatype-task-params: &sonatype-task-params
SONATYPE_USERNAME: ((sonatype-username))
SONATYPE_PASSWORD: ((sonatype-password))
SONATYPE_URL: ((sonatype-url))
SONATYPE_STAGING_PROFILE: ((sonatype-staging-profile))
artifactory-task-params: &artifactory-task-params
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
build-project-task-params: &build-project-task-params
BRANCH: ((branch))
<<: *gradle-enterprise-task-params
docker-resource-source: &docker-resource-source
username: ((docker-hub-username))
password: ((docker-hub-password))
slack-fail-params: &slack-fail-params
text: >
:concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>
[$TEXT_FILE_CONTENT]
text_file: git-repo/build/build-scan-uri.txt
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
changelog-task-params: &changelog-task-params
name: generated-changelog/tag
tag: generated-changelog/tag
body: generated-changelog/changelog.md
github-task-params: &github-task-params
GITHUB_USERNAME: ((github-username))
GITHUB_TOKEN: ((github-ci-release-token))
resource_types:
- name: registry-image
type: registry-image
source:
<<: *docker-resource-source
repository: concourse/registry-image-resource
tag: 1.7.1
- name: artifactory-resource
type: registry-image
source:
<<: *docker-resource-source
repository: springio/artifactory-resource
tag: 0.0.18
- name: github-release
type: registry-image
source:
<<: *docker-resource-source
repository: concourse/github-release-resource
tag: 1.8.0
- name: github-status-resource
type: registry-image
source:
<<: *docker-resource-source
repository: dpb587/github-status-resource
tag: master
- name: slack-notification
type: registry-image
source:
<<: *docker-resource-source
repository: cfcommunity/slack-notification-resource
tag: latest
resources:
- name: git-repo
type: git
icon: github
source:
<<: *git-repo-resource-source
- name: every-morning
type: time
icon: alarm
source:
start: 8:00 AM
stop: 9:00 AM
location: Europe/Vienna
- name: ci-images-git-repo
type: git
icon: github
source:
uri: ((github-repo))
branch: ((branch))
paths: ["ci/images/*"]
- name: ci-image
type: registry-image
icon: docker
source:
<<: *docker-resource-source
repository: ((docker-hub-organization))/spring-framework-ci
tag: ((milestone))
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
source:
uri: ((artifactory-server))
username: ((artifactory-username))
password: ((artifactory-password))
build_name: ((build-name))
- name: repo-status-build
type: github-status-resource
icon: eye-check-outline
source:
repository: ((github-repo-name))
access_token: ((github-ci-status-token))
branch: ((branch))
context: build
- name: repo-status-jdk17-build
type: github-status-resource
icon: eye-check-outline
source:
repository: ((github-repo-name))
access_token: ((github-ci-status-token))
branch: ((branch))
context: jdk17-build
- name: slack-alert
type: slack-notification
icon: slack
source:
url: ((slack-webhook-url))
- name: github-pre-release
type: github-release
icon: briefcase-download-outline
source:
owner: spring-projects
repository: spring-framework
access_token: ((github-ci-release-token))
pre_release: true
release: false
- name: github-release
type: github-release
icon: briefcase-download
source:
owner: spring-projects
repository: spring-framework
access_token: ((github-ci-release-token))
pre_release: false
jobs:
- name: build-ci-images
plan:
- get: git-repo
- get: ci-images-git-repo
trigger: true
- task: build-ci-image
privileged: true
file: git-repo/ci/tasks/build-ci-image.yml
output_mapping:
image: ci-image
vars:
ci-image-name: ci-image
<<: *docker-resource-source
- put: ci-image
params:
image: ci-image/image.tar
- name: build
serial: true
public: true
plan:
- get: ci-image
- get: git-repo
trigger: true
- put: repo-status-build
params: { state: "pending", commit: "git-repo" }
- do:
- task: build-project
image: ci-image
file: git-repo/ci/tasks/build-project.yml
privileged: true
timeout: ((task-timeout))
params:
<<: *build-project-task-params
on_failure:
do:
- put: repo-status-build
params: { state: "failure", commit: "git-repo" }
- put: slack-alert
params:
<<: *slack-fail-params
- put: repo-status-build
params: { state: "success", commit: "git-repo" }
- put: artifactory-repo
params: &artifactory-params
signing_key: ((signing-key))
signing_passphrase: ((signing-passphrase))
repo: libs-snapshot-local
folder: distribution-repository
build_uri: "https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}"
build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}"
disable_checksum_uploads: true
threads: 8
artifact_set:
- include:
- "/**/spring-*.zip"
properties:
"zip.name": "spring-framework"
"zip.displayname": "Spring Framework"
"zip.deployed": "false"
- include:
- "/**/spring-*-docs.zip"
properties:
"zip.type": "docs"
- include:
- "/**/spring-*-dist.zip"
properties:
"zip.type": "dist"
- include:
- "/**/spring-*-schema.zip"
properties:
"zip.type": "schema"
get_params:
threads: 8
- name: jdk17-build
serial: true
public: true
plan:
- get: ci-image
- get: git-repo
- get: every-morning
trigger: true
- put: repo-status-jdk17-build
params: { state: "pending", commit: "git-repo" }
- do:
- task: check-project
image: ci-image
file: git-repo/ci/tasks/check-project.yml
privileged: true
timeout: ((task-timeout))
params:
TEST_TOOLCHAIN: 17
<<: *build-project-task-params
on_failure:
do:
- put: repo-status-jdk17-build
params: { state: "failure", commit: "git-repo" }
- put: slack-alert
params:
<<: *slack-fail-params
- put: repo-status-jdk17-build
params: { state: "success", commit: "git-repo" }
- name: stage-milestone
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- task: stage
image: ci-image
file: git-repo/ci/tasks/stage-version.yml
params:
RELEASE_TYPE: M
<<: *gradle-enterprise-task-params
- put: artifactory-repo
params:
<<: *artifactory-params
repo: libs-staging-local
- put: git-repo
params:
repository: stage-git-repo
- name: promote-milestone
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- get: artifactory-repo
trigger: false
passed: [stage-milestone]
params:
download_artifacts: false
save_build_info: true
- task: promote
file: git-repo/ci/tasks/promote-version.yml
params:
RELEASE_TYPE: M
<<: *artifactory-task-params
- task: generate-changelog
file: git-repo/ci/tasks/generate-changelog.yml
params:
RELEASE_TYPE: M
<<: *github-task-params
- put: github-pre-release
params:
<<: *changelog-task-params
- name: stage-rc
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- task: stage
image: ci-image
file: git-repo/ci/tasks/stage-version.yml
params:
RELEASE_TYPE: RC
<<: *gradle-enterprise-task-params
- put: artifactory-repo
params:
<<: *artifactory-params
repo: libs-staging-local
- put: git-repo
params:
repository: stage-git-repo
- name: promote-rc
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- get: artifactory-repo
trigger: false
passed: [stage-rc]
params:
download_artifacts: false
save_build_info: true
- task: promote
file: git-repo/ci/tasks/promote-version.yml
params:
RELEASE_TYPE: RC
<<: *artifactory-task-params
- task: generate-changelog
file: git-repo/ci/tasks/generate-changelog.yml
params:
RELEASE_TYPE: RC
<<: *github-task-params
- put: github-pre-release
params:
<<: *changelog-task-params
- name: stage-release
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- task: stage
image: ci-image
file: git-repo/ci/tasks/stage-version.yml
params:
RELEASE_TYPE: RELEASE
<<: *gradle-enterprise-task-params
- put: artifactory-repo
params:
<<: *artifactory-params
repo: libs-staging-local
- put: git-repo
params:
repository: stage-git-repo
- name: promote-release
serial: true
plan:
- get: ci-image
- get: git-repo
trigger: false
- get: artifactory-repo
trigger: false
passed: [stage-release]
params:
download_artifacts: true
save_build_info: true
- task: promote
file: git-repo/ci/tasks/promote-version.yml
params:
RELEASE_TYPE: RELEASE
<<: *artifactory-task-params
<<: *sonatype-task-params
- name: create-github-release
serial: true
plan:
- get: ci-image
- get: git-repo
- get: artifactory-repo
trigger: true
passed: [promote-release]
params:
download_artifacts: false
save_build_info: true
- task: generate-changelog
file: git-repo/ci/tasks/generate-changelog.yml
params:
RELEASE_TYPE: RELEASE
<<: *github-task-params
- put: github-release
params:
<<: *changelog-task-params
groups:
- name: "builds"
jobs: ["build", "jdk17-build"]
- name: "releases"
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
- name: "ci-images"
jobs: ["build-ci-images"]
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
pushd git-repo > /dev/null
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 check
popd > /dev/null
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
repository=$(pwd)/distribution-repository
pushd git-repo > /dev/null
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 -PdeploymentRepository=${repository} build publishAllPublicationsToDeploymentRepository
popd > /dev/null
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
pushd git-repo > /dev/null
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK17 \
-PmainToolchain=${MAIN_TOOLCHAIN} -PtestToolchain=${TEST_TOOLCHAIN} --no-daemon --max-workers=4 check
popd > /dev/null
-2
View File
@@ -1,2 +0,0 @@
source /opt/concourse-java.sh
setup_symlinks
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
set -e
CONFIG_DIR=git-repo/ci/config
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
java -jar /github-changelog-generator.jar \
--spring.config.location=${CONFIG_DIR}/changelog-generator.yml \
${version} generated-changelog/changelog.md
echo ${version} > generated-changelog/version
echo v${version} > generated-changelog/tag
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
source $(dirname $0)/common.sh
CONFIG_DIR=git-repo/ci/config
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json
java -jar /concourse-release-scripts.jar \
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION artifactory-repo || { exit 1; }
java -jar /concourse-release-scripts.jar \
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; }
echo "Promotion complete"
echo $version > version/version
-50
View File
@@ -1,50 +0,0 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
repository=$(pwd)/distribution-repository
pushd git-repo > /dev/null
git fetch --tags --all > /dev/null
popd > /dev/null
git clone git-repo stage-git-repo > /dev/null
pushd stage-git-repo > /dev/null
snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
if [[ $RELEASE_TYPE = "M" ]]; then
stageVersion=$( get_next_milestone_release $snapshotVersion)
nextVersion=$snapshotVersion
elif [[ $RELEASE_TYPE = "RC" ]]; then
stageVersion=$( get_next_rc_release $snapshotVersion)
nextVersion=$snapshotVersion
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
stageVersion=$( get_next_release $snapshotVersion)
nextVersion=$( bump_version_number $snapshotVersion)
else
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
fi
echo "Staging $stageVersion (next version will be $nextVersion)"
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
git config user.name "Spring Builds" > /dev/null
git config user.email "spring-builds@users.noreply.github.com" > /dev/null
git add gradle.properties > /dev/null
git commit -m"Release v$stageVersion" > /dev/null
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
./gradlew --no-daemon --max-workers=4 -PdeploymentRepository=${repository} build publishAllPublicationsToDeploymentRepository
git reset --hard HEAD^ > /dev/null
if [[ $nextVersion != $snapshotVersion ]]; then
echo "Setting next development version (v$nextVersion)"
sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
git add gradle.properties > /dev/null
git commit -m"Next development version (v$nextVersion)" > /dev/null
fi;
echo "Staging Complete"
popd > /dev/null
-29
View File
@@ -1,29 +0,0 @@
---
platform: linux
image_resource:
type: registry-image
source:
repository: concourse/oci-build-task
tag: 0.10.0
username: ((docker-hub-username))
password: ((docker-hub-password))
inputs:
- name: ci-images-git-repo
outputs:
- name: image
caches:
- path: ci-image-cache
params:
CONTEXT: ci-images-git-repo/ci/images
DOCKERFILE: ci-images-git-repo/ci/images/ci-image/Dockerfile
DOCKER_HUB_AUTH: ((docker-hub-auth))
run:
path: /bin/sh
args:
- "-c"
- |
mkdir -p /root/.docker
cat > /root/.docker/config.json <<EOF
{ "auths": { "https://index.docker.io/v1/": { "auth": "$DOCKER_HUB_AUTH" }}}
EOF
build
-19
View File
@@ -1,19 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
caches:
- path: gradle
params:
BRANCH:
CI: true
GRADLE_ENTERPRISE_ACCESS_KEY:
GRADLE_ENTERPRISE_CACHE_USERNAME:
GRADLE_ENTERPRISE_CACHE_PASSWORD:
GRADLE_ENTERPRISE_URL: https://ge.spring.io
run:
path: bash
args:
- -ec
- |
${PWD}/git-repo/ci/scripts/build-pr.sh
-22
View File
@@ -1,22 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: distribution-repository
- name: git-repo
caches:
- path: gradle
params:
BRANCH:
CI: true
GRADLE_ENTERPRISE_ACCESS_KEY:
GRADLE_ENTERPRISE_CACHE_USERNAME:
GRADLE_ENTERPRISE_CACHE_PASSWORD:
GRADLE_ENTERPRISE_URL: https://ge.spring.io
run:
path: bash
args:
- -ec
- |
${PWD}/git-repo/ci/scripts/build-project.sh
-24
View File
@@ -1,24 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: distribution-repository
- name: git-repo
caches:
- path: gradle
params:
BRANCH:
CI: true
MAIN_TOOLCHAIN:
TEST_TOOLCHAIN:
GRADLE_ENTERPRISE_ACCESS_KEY:
GRADLE_ENTERPRISE_CACHE_USERNAME:
GRADLE_ENTERPRISE_CACHE_PASSWORD:
GRADLE_ENTERPRISE_URL: https://ge.spring.io
run:
path: bash
args:
- -ec
- |
${PWD}/git-repo/ci/scripts/check-project.sh
-22
View File
@@ -1,22 +0,0 @@
---
platform: linux
image_resource:
type: registry-image
source:
repository: springio/github-changelog-generator
tag: '0.0.7'
username: ((docker-hub-username))
password: ((docker-hub-password))
inputs:
- name: git-repo
- name: artifactory-repo
outputs:
- name: generated-changelog
params:
GITHUB_ORGANIZATION:
GITHUB_REPO:
GITHUB_USERNAME:
GITHUB_TOKEN:
RELEASE_TYPE:
run:
path: git-repo/ci/scripts/generate-changelog.sh
-25
View File
@@ -1,25 +0,0 @@
---
platform: linux
image_resource:
type: registry-image
source:
repository: springio/concourse-release-scripts
tag: '0.3.4'
username: ((docker-hub-username))
password: ((docker-hub-password))
inputs:
- name: git-repo
- name: artifactory-repo
outputs:
- name: version
params:
RELEASE_TYPE:
ARTIFACTORY_SERVER:
ARTIFACTORY_USERNAME:
ARTIFACTORY_PASSWORD:
SONATYPE_USER:
SONATYPE_PASSWORD:
SONATYPE_URL:
SONATYPE_STAGING_PROFILE:
run:
path: git-repo/ci/scripts/promote-version.sh
-17
View File
@@ -1,17 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: stage-git-repo
- name: distribution-repository
params:
RELEASE_TYPE:
CI: true
GRADLE_ENTERPRISE_CACHE_USERNAME:
GRADLE_ENTERPRISE_CACHE_PASSWORD:
GRADLE_ENTERPRISE_URL: https://ge.spring.io
caches:
- path: gradle
run:
path: git-repo/ci/scripts/stage-version.sh
+267
View File
@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8"?>
<profiles version="11">
<profile kind="CodeFormatterProfile" name="Spring" version="11">
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
</profile>
</profiles>
-23
View File
@@ -1,23 +0,0 @@
description = "Spring Framework (Bill of Materials)"
apply plugin: 'java-platform'
apply from: "$rootDir/gradle/publications.gradle"
group = "org.springframework"
dependencies {
constraints {
parent.moduleProjects.sort { "$it.name" }.each {
api it
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'spring-framework-bom'
from components.javaPlatform
}
}
}
-5
View File
@@ -1,5 +0,0 @@
version=5.3.32
org.gradle.jvmargs=-Xmx2048m
org.gradle.caching=true
org.gradle.parallel=true
kotlin.stdlib.default.dependency=false
-30
View File
@@ -1,30 +0,0 @@
tasks.findByName("dokkaHtmlPartial")?.configure {
outputDirectory.set(new File(buildDir, "docs/kdoc"))
dokkaSourceSets {
configureEach {
sourceRoots.setFrom(file("src/main/kotlin"))
classpath.from(sourceSets["main"].runtimeClasspath)
externalDocumentationLink {
url.set(new URL("https://docs.spring.io/spring-framework/docs/current/javadoc-api/"))
}
externalDocumentationLink {
url.set(new URL("https://projectreactor.io/docs/core/release/api/"))
}
externalDocumentationLink {
url.set(new URL("https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/"))
}
externalDocumentationLink {
url.set(new URL("https://kotlin.github.io/kotlinx.coroutines/"))
}
externalDocumentationLink {
url.set(new URL("https://javadoc.io/doc/org.hamcrest/hamcrest/2.1/"))
}
externalDocumentationLink {
url.set(new URL("https://javadoc.io/doc/javax.servlet/javax.servlet-api/latest/"))
}
externalDocumentationLink {
url.set(new URL("https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/"))
}
}
}
}
-249
View File
@@ -1,249 +0,0 @@
configurations {
asciidoctorExt
}
dependencies {
asciidoctorExt("io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.6.1")
}
repositories {
maven {
url "https://repo.spring.io/release"
mavenContent {
includeGroup "io.spring.asciidoctor"
}
}
}
/**
* Produce Javadoc for all Spring Framework modules in "build/docs/javadoc"
*/
task api(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
title = "${rootProject.description} ${version} API"
dependsOn {
moduleProjects.collect {
it.tasks.getByName("jar")
}
}
doFirst {
classpath = files(
// ensure the javadoc process can resolve types compiled from .aj sources
project(":spring-aspects").sourceSets.main.output
)
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath })
}
options {
encoding = "UTF-8"
memberLevel = JavadocMemberLevel.PROTECTED
author = true
header = rootProject.description
use = true
overview = "src/docs/api/overview.html"
stylesheetFile = file("src/docs/api/stylesheet.css")
splitIndex = true
links(project.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
addBooleanOption('Xwerror', true) // fail build on Javadoc warnings
if (JavaVersion.current().isJava9Compatible()) {
addBooleanOption('html5', true)
}
}
source moduleProjects.collect { project ->
project.sourceSets.main.allJava
}
maxMemory = "1024m"
destinationDir = file("$buildDir/docs/javadoc")
}
/**
* Produce KDoc for all Spring Framework modules in "build/docs/kdoc"
*/
pluginManager.withPlugin("kotlin") {
tasks.dokkaHtmlMultiModule.configure {
dependsOn {
tasks.getByName("api")
}
moduleName.set("spring-framework")
outputDirectory.set(project.file("$buildDir/docs/kdoc"))
}
}
task downloadResources(type: Download) {
src "https://repo.spring.io/artifactory/snapshot/io/spring/docresources/" +
"spring-doc-resources/0.2.6-SNAPSHOT/spring-doc-resources-0.2.6-20210308.231804-2.zip"
dest project.file("$buildDir/docs/spring-doc-resources.zip")
onlyIfModified true
useETag "all"
}
task extractDocResources(type: Copy, dependsOn: downloadResources) {
from project.zipTree(downloadResources.dest);
into "$buildDir/docs/spring-docs-resources/"
}
asciidoctorj {
def docRoot = 'https://docs.spring.io'
def docsSpringFramework = "${docRoot}/spring-framework/docs/${project.version}"
version = '2.4.1'
fatalWarnings ".*"
options doctype: 'book', eruby: 'erubis'
attributes([
icons: 'font',
idprefix: '',
idseparator: '-',
docinfo: 'shared,private-header', // https://docs.asciidoctor.org/asciidoctor/latest/docinfo/
revnumber: project.version,
sectanchors: '',
sectnums: '',
'source-highlighter': 'highlight.js',
highlightjsdir: 'js/highlight',
'highlightjs-theme': 'googlecode',
stylesdir: 'css/',
stylesheet: 'stylesheet.css',
'spring-version': project.version,
'spring-framework-main-code': 'https://github.com/spring-projects/spring-framework/tree/main',
'doc-root': docRoot,
'docs-spring-framework': docsSpringFramework,
'api-spring-framework': "${docsSpringFramework}/javadoc-api/org/springframework"
])
}
/**
* Generate the Spring Framework Reference documentation from "src/docs/asciidoc"
* in "build/docs/ref-docs/html5".
*/
asciidoctor {
baseDirFollowsSourceDir()
configurations 'asciidoctorExt'
sources {
include '*.adoc'
}
outputDir "$buildDir/docs/ref-docs/html5"
logDocuments = true
resources {
from(sourceDir) {
include 'images/*.png', 'css/**', 'js/**'
}
from extractDocResources
}
}
/**
* Generate the Spring Framework Reference documentation from "src/docs/asciidoc"
* in "build/docs/ref-docs/pdf".
*/
asciidoctorPdf {
baseDirFollowsSourceDir()
configurations 'asciidoctorExt'
sources {
include '*.adoc'
}
outputDir "$buildDir/docs/ref-docs/pdf"
logDocuments = true
}
/**
* Zip all docs (API and reference) into a single archive
*/
task docsZip(type: Zip, dependsOn: ['api', 'asciidoctor', 'asciidoctorPdf', 'dokkaHtmlMultiModule']) {
group = "Distribution"
description = "Builds -${archiveClassifier} archive containing api and reference " +
"for deployment at https://docs.spring.io/spring-framework/docs/."
archiveBaseName.set("spring-framework")
archiveClassifier.set("docs")
from("src/dist") {
include "changelog.txt"
}
from (api) {
into "javadoc-api"
}
from ("$asciidoctor.outputDir") {
into "reference/html"
}
from ("$asciidoctorPdf.outputDir") {
into "reference/pdf"
}
from (dokkaHtmlMultiModule.outputDirectory) {
into "kdoc-api"
}
}
/**
* Zip all Spring Framework schemas into a single archive
*/
task schemaZip(type: Zip) {
group = "Distribution"
archiveBaseName.set("spring-framework")
archiveClassifier.set("schema")
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at https://springframework.org/schema."
duplicatesStrategy DuplicatesStrategy.EXCLUDE
moduleProjects.each { module ->
def Properties schemas = new Properties();
module.sourceSets.main.resources.find {
(it.path.endsWith("META-INF/spring.schemas") || it.path.endsWith("META-INF\\spring.schemas"))
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
assert shortName != key
File xsdFile = module.sourceSets.main.resources.find {
(it.path.endsWith(schemas.get(key)) || it.path.endsWith(schemas.get(key).replaceAll('\\/','\\\\')))
}
assert xsdFile != null
into (shortName) {
from xsdFile.path
}
}
}
}
/**
* Create a distribution zip with everything:
* docs, schemas, jars, source jars, javadoc jars
*/
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = "Distribution"
archiveBaseName.set("spring-framework")
archiveClassifier.set("dist")
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "spring-framework-${project.version}";
from("src/docs/dist") {
include "readme.txt"
include "license.txt"
include "notice.txt"
into "${baseDir}"
expand(copyright: new Date().format("yyyy"), version: project.version)
}
from(zipTree(docsZip.archiveFile)) {
into "${baseDir}/docs"
}
from(zipTree(schemaZip.archiveFile)) {
into "${baseDir}/schema"
}
moduleProjects.each { module ->
into ("${baseDir}/libs") {
from module.jar
if (module.tasks.findByPath("sourcesJar")) {
from module.sourcesJar
}
if (module.tasks.findByPath("javadocJar")) {
from module.javadocJar
}
}
}
}
distZip.mustRunAfter moduleProjects.check
-90
View File
@@ -1,90 +0,0 @@
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: 'eclipse'
eclipse.jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
// Replace classpath entries with project dependencies (GRADLE-1116)
// https://issues.gradle.org/browse/GRADLE-1116
eclipse.classpath.file.whenMerged { classpath ->
def regexp = /.*?\/([^\/]+)\/build\/([^\/]+\/)+(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }
projectOutputDependencies.each { entry ->
def matcher = (entry.path =~ regexp)
if (matcher) {
def projectName = matcher[0][1]
def path = "/${projectName}"
if (!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
def recursiveDependency = entry.path.matches('.+/' + projectName + '/build/([^/]+/)+(?:main|test)')
// Avoid recursive dependency on current project.
if (!recursiveDependency) {
classpath.entries.add(new ProjectDependency(path))
}
}
classpath.entries.remove(entry)
}
}
// Remove any remaining direct depencencies on JARs in the build/libs folder
// except Spring's spring-cglib-repack and spring-objenesis-repack JARs.
classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) }
}
// Use separate main/test outputs (prevents WTP from packaging test classes)
eclipse.classpath.defaultOutputDir = file(project.name + '/bin/eclipse')
eclipse.classpath.file.beforeMerged { classpath ->
classpath.entries.findAll{ it instanceof SourceFolder }.each {
if (it.output.startsWith('bin/')) {
it.output = null
}
}
}
eclipse.classpath.file.whenMerged {
entries.findAll{ it instanceof SourceFolder }.each {
it.output = 'bin/' + it.path.split('/')[1]
}
}
// Ensure project dependencies come after 3rd-party libs (SPR-11836)
// https://jira.spring.io/browse/SPR-11836
eclipse.classpath.file.whenMerged {
entries.findAll { it instanceof ProjectDependency }.each {
// delete from original position
entries.remove(it)
// append to end of classpath
entries.add(it)
}
}
// Ensure that JMH sources and resources are treated as test classpath entries
// so that they can see test fixtures.
// https://github.com/melix/jmh-gradle-plugin/issues/157
eclipse.classpath.file.whenMerged {
entries.findAll { it.path =~ /src\/jmh\/(java|resources)/ }.each {
it.entryAttributes['test'] = 'true'
}
}
// Include project specific settings
task eclipseSettings(type: Copy) {
from rootProject.files(
'src/eclipse/org.eclipse.core.resources.prefs',
'src/eclipse/org.eclipse.jdt.core.prefs',
'src/eclipse/org.eclipse.jdt.ui.prefs')
into project.file('.settings/')
outputs.upToDateWhen { false }
}
task cleanEclipseSettings(type: Delete) {
delete project.file('.settings/org.eclipse.core.resources.prefs')
delete project.file('.settings/org.eclipse.jdt.core.prefs')
delete project.file('.settings/org.eclipse.jdt.ui.prefs')
}
tasks['eclipse'].dependsOn(eclipseSettings)
tasks['eclipseJdt'].dependsOn(eclipseSettings)
tasks['cleanEclipse'].dependsOn(cleanEclipseSettings)
-64
View File
@@ -1,64 +0,0 @@
apply plugin: "maven-publish"
publishing {
publications {
mavenJava(MavenPublication) {
pom {
afterEvaluate {
name = project.description
description = project.description
}
url = "https://github.com/spring-projects/spring-framework"
organization {
name = "Spring IO"
url = "https://spring.io/projects/spring-framework"
}
licenses {
license {
name = "Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
scm {
url = "https://github.com/spring-projects/spring-framework"
connection = "scm:git:git://github.com/spring-projects/spring-framework"
developerConnection = "scm:git:git://github.com/spring-projects/spring-framework"
}
developers {
developer {
id = "jhoeller"
name = "Juergen Hoeller"
email = "jhoeller@pivotal.io"
}
}
issueManagement {
system = "GitHub"
url = "https://github.com/spring-projects/spring-framework/issues"
}
}
versionMapping {
usage('java-api') {
fromResolutionResult()
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
}
configureDeploymentRepository(project)
void configureDeploymentRepository(Project project) {
project.plugins.withType(MavenPublishPlugin.class).all {
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
if (project.hasProperty("deploymentRepository")) {
publishing.repositories.maven {
it.url = project.property("deploymentRepository")
it.name = "deployment"
}
}
}
}
-102
View File
@@ -1,102 +0,0 @@
apply plugin: 'java-library'
apply plugin: 'org.springframework.build.compile'
apply plugin: 'org.springframework.build.optional-dependencies'
// Uncomment the following for Shadow support in the jmhJar block.
// Currently commented out due to ZipException: archive is not a ZIP archive
// apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'me.champeau.jmh'
apply from: "$rootDir/gradle/publications.gradle"
dependencies {
jmh 'org.openjdk.jmh:jmh-core:1.32'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.32'
jmh 'net.sf.jopt-simple:jopt-simple'
}
jmh {
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.findByName("processJmhResources").configure {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
jmhJar {
// Uncomment the following for Shadow's Transformer support.
// mergeServiceFiles()
// append('META-INF/spring.handlers')
// append('META-INF/spring.schemas')
// append('META-INF/spring.tooling')
exclude 'LICENSE'
exclude 'THIRD-PARTY'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE*'
exclude 'META-INF/NOTICE'
exclude 'META-INF/THIRD-PARTY'
}
jar {
manifest.attributes["Implementation-Title"] = project.name
manifest.attributes["Implementation-Version"] = project.version
manifest.attributes["Automatic-Module-Name"] = project.name.replace('-', '.') // for Jigsaw
manifest.attributes["Created-By"] =
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
from("${rootDir}/src/docs/dist") {
include "license.txt"
include "notice.txt"
into "META-INF"
expand(copyright: new Date().format("yyyy"), version: project.version)
}
}
normalization {
runtimeClasspath {
ignore "META-INF/MANIFEST.MF"
}
}
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.encoding = "UTF-8"
options.memberLevel = JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
options.use = true
options.links(project.ext.javadocLinks)
options.addStringOption("Xdoclint:none", "-quiet")
// Suppress warnings due to cross-module @see and @link references.
// Note that global 'api' task does display all warnings.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
}
task sourcesJar(type: Jar, dependsOn: classes) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from sourceSets.main.allSource
// Don't include or exclude anything explicitly by default. See SPR-12085.
}
task javadocJar(type: Jar) {
archiveClassifier.set("javadoc")
from javadoc
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
// Disable publication of test fixture artifacts.
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
-171
View File
@@ -1,171 +0,0 @@
/**
* Apply the JVM Toolchain conventions
* See https://docs.gradle.org/current/userguide/toolchains.html
*
* One can choose the toolchain to use for compiling the MAIN sources and/or compiling
* and running the TEST sources. These options apply to Java, Kotlin and Groovy sources
* when available.
* {@code "./gradlew check -PmainToolchain=8 -PtestToolchain=11"} will use:
* <ul>
* <li>a JDK8 toolchain for compiling the main SourceSet
* <li>a JDK11 toolchain for compiling and running the test SourceSet
* </ul>
*
* By default, the build will fall back to using the current JDK and 1.8 language level for all sourceSets.
*
* Gradle will automatically detect JDK distributions in well-known locations.
* The following command will list the detected JDKs on the host.
* {@code
* $ ./gradlew -q javaToolchains
* }
*
* We can also configure ENV variables and let Gradle know about them:
* {@code
* $ echo JDK11
* /opt/openjdk/java11
* $ echo JDK15
* /opt/openjdk/java15
* $ ./gradlew -Porg.gradle.java.installations.fromEnv=JDK11,JDK15 check
* }
*
* @author Brian Clozel
* @author Sam Brannen
*/
def mainToolchainConfigured() {
return project.hasProperty('mainToolchain') && project.mainToolchain
}
def testToolchainConfigured() {
return project.hasProperty('testToolchain') && project.testToolchain
}
def mainToolchainLanguageVersion() {
if (mainToolchainConfigured()) {
return JavaLanguageVersion.of(project.mainToolchain.toString())
}
return JavaLanguageVersion.of(8)
}
def testToolchainLanguageVersion() {
if (testToolchainConfigured()) {
return JavaLanguageVersion.of(project.testToolchain.toString())
}
return mainToolchainLanguageVersion()
}
plugins.withType(JavaPlugin) {
// Configure the Java Toolchain if the 'mainToolchain' is configured
if (mainToolchainConfigured()) {
java {
toolchain {
languageVersion = mainToolchainLanguageVersion()
}
}
}
else {
// Fallback to JDK8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
}
// Configure a specific Java Toolchain for compiling and running tests if the 'testToolchain' property is defined
if (testToolchainConfigured()) {
def testLanguageVersion = testToolchainLanguageVersion()
tasks.withType(JavaCompile).matching { it.name.contains("Test") }.configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = testLanguageVersion
}
}
tasks.withType(Test).configureEach{
javaLauncher = javaToolchains.launcherFor {
languageVersion = testLanguageVersion
}
if(testLanguageVersion == JavaLanguageVersion.of(17)) {
jvmArgs(["--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED"])
}
}
}
}
plugins.withType(GroovyPlugin) {
// Fallback to JDK8
if (!mainToolchainConfigured()) {
compileGroovy {
sourceCompatibility = JavaVersion.VERSION_1_8
}
}
}
pluginManager.withPlugin("kotlin") {
// Configure the Kotlin compiler if the 'mainToolchain' property is defined
if (mainToolchainConfigured()) {
def mainLanguageVersion = mainToolchainLanguageVersion()
def compiler = javaToolchains.compilerFor {
languageVersion = mainLanguageVersion
}
// See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm
def javaVersion = mainLanguageVersion.toString() == '8' ? '1.8' : mainLanguageVersion.toString()
compileKotlin {
kotlinOptions {
jvmTarget = javaVersion
jdkHome = compiler.get().metadata.installationPath.asFile.absolutePath
}
}
// Compile the test classes with the same version, 'testToolchain' will override if defined
compileTestKotlin {
kotlinOptions {
jvmTarget = javaVersion
jdkHome = compiler.get().metadata.installationPath.asFile.absolutePath
}
}
}
else {
// Fallback to JDK8
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}
}
}
// Configure the JMH plugin to use the toolchain for generating and running JMH bytecode
pluginManager.withPlugin("me.champeau.jmh") {
if (mainToolchainConfigured() || testToolchainConfigured()) {
tasks.matching { it.name.contains('jmh') && it.hasProperty('javaLauncher') }.configureEach {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(testToolchainLanguageVersion())
})
}
tasks.withType(JavaCompile).matching { it.name.contains("Jmh") }.configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = testToolchainLanguageVersion()
}
}
}
}
// Store resolved Toolchain JVM information as custom values in the build scan.
rootProject.ext {
resolvedMainToolchain = false
resolvedTestToolchain = false
}
gradle.taskGraph.afterTask { Task task, TaskState state ->
if (mainToolchainConfigured() && !resolvedMainToolchain && task instanceof JavaCompile && task.javaCompiler.isPresent()) {
def metadata = task.javaCompiler.get().metadata
task.project.buildScan.value('Main toolchain', "$metadata.vendor $metadata.languageVersion ($metadata.installationPath)")
resolvedMainToolchain = true
}
if (testToolchainConfigured() && !resolvedTestToolchain && task instanceof Test && task.javaLauncher.isPresent()) {
def metadata = task.javaLauncher.get().metadata
task.project.buildScan.value('Test toolchain', "$metadata.vendor $metadata.languageVersion ($metadata.installationPath)")
resolvedTestToolchain = true
}
}
Binary file not shown.
-5
View File
@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
-234
View File
@@ -1,234 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
-89
View File
@@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-56
View File
@@ -1,56 +0,0 @@
# Spring Framework - Eclipse/STS Project Import Guide
This document will guide you through the process of importing the Spring Framework
projects into Eclipse or the Spring Tool Suite (_STS_). It is recommended that you
have a recent version of Eclipse. As a bare minimum you will need Eclipse with full Java
8 support, Eclipse Buildship, and the Groovy plugin.
The following instructions have been tested against [STS](https://spring.io/tools) 4.12.0
([download](https://github.com/spring-projects/sts4/wiki/Previous-Versions#spring-tools-4120-changelog))
(based on Eclipse 4.21) with [Eclipse Buildship](https://projects.eclipse.org/projects/tools.buildship).
The instructions should work with the latest Eclipse distribution as long as you install
[Buildship](https://marketplace.eclipse.org/content/buildship-gradle-integration). Note
that STS 4 comes with Buildship preinstalled.
## Steps
_When instructed to execute `./gradlew` from the command line, be sure to execute it within your locally cloned `spring-framework` working directory._
1. Install the [Groovy Development Tools](https://marketplace.eclipse.org/content/groovy-development-tools).
1. Switch to Groovy 3.0 in Eclipse (Preferences &#8594; Groovy &#8594; Compiler &#8594; Switch to 3.0...).
- If you encounter build errors stating something similar to _"Groovy: compiler mismatch: project level is 2.5, workspace level is 3.0"_, change the Groovy compiler version to 3.0 for each affected project.
1. Ensure that the _Forbidden reference (access rule)_ in Eclipse is set to `Info`
(Preferences &#8594; Java &#8594; Compiler &#8594; Errors/Warnings &#8594; Deprecated and restricted API &#8594; Forbidden reference (access rule)).
1. Optionally install the [Kotlin Plugin for Eclipse](https://marketplace.eclipse.org/content/kotlin-plugin-eclipse) if you need to execute Kotlin-based tests or develop Kotlin extensions.
- **NOTE**: As of September 21, 2021, it appears that the Kotlin Plugin for Eclipse does not yet work with Eclipse 4.21.
1. Optionally install the [AspectJ Development Tools](https://marketplace.eclipse.org/content/aspectj-development-tools) (_AJDT_) if you need to work with the `spring-aspects` project.
- **NOTE**: As of September 21, 2021, it appears that the AspectJ Development Tools do not yet work with Eclipse 4.21.
1. Optionally install the [TestNG plugin](https://testng.org/doc/eclipse.html) in Eclipse if you need to execute individual TestNG test classes or tests in the `spring-test` module.
- As an alternative to installing the TestNG plugin, you can execute the `org.springframework.test.context.testng.TestNGTestSuite` class as a "JUnit 5" test class in Eclipse.
1. Build `spring-oxm` from the command line with `./gradlew :spring-oxm:check`.
1. To apply Spring Framework specific settings, run `./gradlew cleanEclipse eclipse` from the command line.
1. Import all projects into Eclipse (File &#8594; Import &#8594; Gradle &#8594; Existing Gradle Project &#8594; Navigate to the locally cloned `spring-framework` directory &#8594; Select Finish).
- If you have not installed AJDT, exclude the `spring-aspects` project from the import, if prompted, or close it after the import.
- If you run into errors during the import, you may need to set the _Java home_ for Gradle Buildship to the location of your JDK 8 installation in Eclipse (Preferences &#8594; Gradle &#8594; Java home).
1. If you need to execute JAXB-related tests in the `spring-oxm` project and wish to have the generated sources available, add the `build/generated-sources/jaxb` folder to the build path (right click on the `jaxb` folder and select "Build Path &#8594; Use as Source Folder").
- If you do not see the `build` folder in the `spring-oxm` project, ensure that the "Gradle build folder" is not filtered out from the view. This setting is available under "Filters" in the configuration of the Package Explorer (available by clicking on the _three vertical dots_ in the upper right corner of the Package Explorer).
1. Code away!
## Known Issues
1. `spring-core` should be pre-compiled due to repackaged dependencies.
- See `*RepackJar` tasks in the `spring-core.gradle` build file.
1. `spring-oxm` should be pre-compiled due to JAXB types generated for tests.
- Note that executing `./gradlew :spring-oxm:check` as explained in the _Steps_ above will compile `spring-core` and generate JAXB types for `spring-oxm`.
1. `spring-aspects` does not compile due to references to aspect types unknown to Eclipse.
- If you installed _AJDT_ into Eclipse it should work.
1. While JUnit tests pass from the command line with Gradle, some may fail when run from
the IDE.
- Resolving this is a work in progress.
- If attempting to run all JUnit tests from within the IDE, you may need to set the following VM options to avoid out of memory errors: `-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m`
## Tips
In any case, please do not check in your own generated `.classpath` file, `.project`
file, or `.settings` folder. You'll notice these files are already intentionally in
`.gitignore`. The same policy holds for IDEA metadata.
-36
View File
@@ -1,36 +0,0 @@
The following has been tested against IntelliJ IDEA 2016.2.2
## Steps
_Within your locally cloned spring-framework working directory:_
1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
3. When prompted exclude the `spring-aspects` module (or after the import via File-> Project Structure -> Modules)
4. Code away
## Known issues
1. `spring-core` and `spring-oxm` should be pre-compiled due to repackaged dependencies.
See `*RepackJar` tasks in the build and https://youtrack.jetbrains.com/issue/IDEA-160605).
2. `spring-aspects` does not compile due to references to aspect types unknown to
IntelliJ IDEA. See https://youtrack.jetbrains.com/issue/IDEA-64446 for details. In the meantime, the
'spring-aspects' can be excluded from the project to avoid compilation errors.
3. While JUnit tests pass from the command line with Gradle, some may fail when run from
IntelliJ IDEA. Resolving this is a work in progress. If attempting to run all JUnit tests from within
IntelliJ IDEA, you will likely need to set the following VM options to avoid out of memory errors:
-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m
4. If you invoke "Rebuild Project" in the IDE, you'll have to generate some test
resources of the `spring-oxm` module again (`./gradlew :spring-oxm:compileTestJava`)
## Tips
In any case, please do not check in your own generated .iml, .ipr, or .iws files.
You'll notice these files are already intentionally in .gitignore. The same policy goes for eclipse metadata.
## FAQ
Q. What about IntelliJ IDEA's own [Gradle support](https://www.jetbrains.com/help/idea/gradle.html)?
A. Keep an eye on https://youtrack.jetbrains.com/issue/IDEA-53476
@@ -1,30 +0,0 @@
description = "Spring Integration Tests"
dependencies {
testImplementation(project(":spring-aop"))
testImplementation(project(":spring-beans"))
testImplementation(project(":spring-context"))
testImplementation(project(":spring-core"))
testImplementation(testFixtures(project(":spring-aop")))
testImplementation(testFixtures(project(":spring-beans")))
testImplementation(testFixtures(project(":spring-core")))
testImplementation(testFixtures(project(":spring-tx")))
testImplementation(project(":spring-expression"))
testImplementation(project(":spring-jdbc"))
testImplementation(project(":spring-orm"))
testImplementation(project(":spring-test"))
testImplementation(project(":spring-tx"))
testImplementation(project(":spring-web"))
testImplementation("javax.inject:javax.inject")
testImplementation("javax.resource:javax.resource-api")
testImplementation("javax.servlet:javax.servlet-api")
testImplementation("org.aspectj:aspectjweaver")
testImplementation("org.hsqldb:hsqldb")
testImplementation("org.hibernate:hibernate-core")
}
normalization {
runtimeClasspath {
ignore "META-INF/MANIFEST.MF"
}
}
@@ -1,119 +0,0 @@
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.config;
import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException;
/**
* Integration tests for advice invocation order for advice configured via the
* AOP namespace.
*
* @author Sam Brannen
* @since 5.2.7
* @see org.springframework.aop.framework.autoproxy.AspectJAutoProxyAdviceOrderIntegrationTests
*/
class AopNamespaceHandlerAdviceOrderIntegrationTests {
@Nested
@SpringJUnitConfig(locations = "AopNamespaceHandlerAdviceOrderIntegrationTests-afterFirst.xml")
@DirtiesContext
class AfterAdviceFirstTests {
@Test
void afterAdviceIsInvokedFirst(@Autowired Echo echo, @Autowired InvocationTrackingAspect aspect) throws Exception {
assertThat(aspect.invocations).isEmpty();
assertThat(echo.echo(42)).isEqualTo(42);
assertThat(aspect.invocations).containsExactly("around - start", "before", "around - end", "after", "after returning");
aspect.invocations.clear();
assertThatException().isThrownBy(() -> echo.echo(new Exception()));
assertThat(aspect.invocations).containsExactly("around - start", "before", "around - end", "after", "after throwing");
}
}
@Nested
@SpringJUnitConfig(locations = "AopNamespaceHandlerAdviceOrderIntegrationTests-afterLast.xml")
@DirtiesContext
class AfterAdviceLastTests {
@Test
void afterAdviceIsInvokedLast(@Autowired Echo echo, @Autowired InvocationTrackingAspect aspect) throws Exception {
assertThat(aspect.invocations).isEmpty();
assertThat(echo.echo(42)).isEqualTo(42);
assertThat(aspect.invocations).containsExactly("around - start", "before", "around - end", "after returning", "after");
aspect.invocations.clear();
assertThatException().isThrownBy(() -> echo.echo(new Exception()));
assertThat(aspect.invocations).containsExactly("around - start", "before", "around - end", "after throwing", "after");
}
}
static class Echo {
Object echo(Object obj) throws Exception {
if (obj instanceof Exception) {
throw (Exception) obj;
}
return obj;
}
}
static class InvocationTrackingAspect {
List<String> invocations = new ArrayList<>();
Object around(ProceedingJoinPoint joinPoint) throws Throwable {
invocations.add("around - start");
try {
return joinPoint.proceed();
}
finally {
invocations.add("around - end");
}
}
void before() {
invocations.add("before");
}
void afterReturning() {
invocations.add("after returning");
}
void afterThrowing() {
invocations.add("after throwing");
}
void after() {
invocations.add("after");
}
}
}
@@ -1,137 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.config;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.testfixture.beans.ITestBean;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.core.testfixture.io.SerializationTestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for scoped proxy use in conjunction with aop: namespace.
* Deemed an integration test because .web mocks and application contexts are required.
*
* @author Rob Harrop
* @author Juergen Hoeller
* @author Chris Beams
* @see org.springframework.aop.config.AopNamespaceHandlerTests
*/
@SpringJUnitWebConfig
class AopNamespaceHandlerScopeIntegrationTests {
@Autowired
ITestBean singletonScoped;
@Autowired
ITestBean requestScoped;
@Autowired
ITestBean sessionScoped;
@Autowired
ITestBean sessionScopedAlias;
@Autowired
ITestBean testBean;
@Test
void testSingletonScoping() throws Exception {
assertThat(AopUtils.isAopProxy(singletonScoped)).as("Should be AOP proxy").isTrue();
boolean condition = singletonScoped instanceof TestBean;
assertThat(condition).as("Should be target class proxy").isTrue();
String rob = "Rob Harrop";
String bram = "Bram Smeets";
assertThat(singletonScoped.getName()).isEqualTo(rob);
singletonScoped.setName(bram);
assertThat(singletonScoped.getName()).isEqualTo(bram);
ITestBean deserialized = SerializationTestUtils.serializeAndDeserialize(singletonScoped);
assertThat(deserialized.getName()).isEqualTo(bram);
}
@Test
void testRequestScoping() throws Exception {
MockHttpServletRequest oldRequest = new MockHttpServletRequest();
MockHttpServletRequest newRequest = new MockHttpServletRequest();
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(oldRequest));
assertThat(AopUtils.isAopProxy(requestScoped)).as("Should be AOP proxy").isTrue();
boolean condition = requestScoped instanceof TestBean;
assertThat(condition).as("Should be target class proxy").isTrue();
assertThat(AopUtils.isAopProxy(testBean)).as("Should be AOP proxy").isTrue();
boolean condition1 = testBean instanceof TestBean;
assertThat(condition1).as("Regular bean should be JDK proxy").isFalse();
String rob = "Rob Harrop";
String bram = "Bram Smeets";
assertThat(requestScoped.getName()).isEqualTo(rob);
requestScoped.setName(bram);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(newRequest));
assertThat(requestScoped.getName()).isEqualTo(rob);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(oldRequest));
assertThat(requestScoped.getName()).isEqualTo(bram);
assertThat(((Advised) requestScoped).getAdvisors().length > 0).as("Should have advisors").isTrue();
}
@Test
void testSessionScoping() throws Exception {
MockHttpSession oldSession = new MockHttpSession();
MockHttpSession newSession = new MockHttpSession();
MockHttpServletRequest request = new MockHttpServletRequest();
request.setSession(oldSession);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
assertThat(AopUtils.isAopProxy(sessionScoped)).as("Should be AOP proxy").isTrue();
boolean condition1 = sessionScoped instanceof TestBean;
assertThat(condition1).as("Should not be target class proxy").isFalse();
assertThat(sessionScopedAlias).isSameAs(sessionScoped);
assertThat(AopUtils.isAopProxy(testBean)).as("Should be AOP proxy").isTrue();
boolean condition = testBean instanceof TestBean;
assertThat(condition).as("Regular bean should be JDK proxy").isFalse();
String rob = "Rob Harrop";
String bram = "Bram Smeets";
assertThat(sessionScoped.getName()).isEqualTo(rob);
sessionScoped.setName(bram);
request.setSession(newSession);
assertThat(sessionScoped.getName()).isEqualTo(rob);
request.setSession(oldSession);
assertThat(sessionScoped.getName()).isEqualTo(bram);
assertThat(((Advised) sessionScoped).getAdvisors().length > 0).as("Should have advisors").isTrue();
}
}
@@ -1,318 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.framework.autoproxy;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.List;
import javax.servlet.ServletException;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
import org.springframework.aop.testfixture.advice.CountingBeforeAdvice;
import org.springframework.aop.testfixture.advice.MethodCounter;
import org.springframework.aop.testfixture.interceptor.NopInterceptor;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.testfixture.beans.ITestBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.lang.Nullable;
import org.springframework.transaction.NoTransactionException;
import org.springframework.transaction.interceptor.TransactionInterceptor;
import org.springframework.transaction.testfixture.CallCountingTransactionManager;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for auto proxy creation by advisor recognition working in
* conjunction with transaction management resources.
*
* @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorTests
*
* @author Rod Johnson
* @author Chris Beams
*/
class AdvisorAutoProxyCreatorIntegrationTests {
private static final Class<?> CLASS = AdvisorAutoProxyCreatorIntegrationTests.class;
private static final String CLASSNAME = CLASS.getSimpleName();
private static final String DEFAULT_CONTEXT = CLASSNAME + "-context.xml";
private static final String ADVISOR_APC_BEAN_NAME = "aapc";
private static final String TXMANAGER_BEAN_NAME = "txManager";
/**
* Return a bean factory with attributes and EnterpriseServices configured.
*/
protected BeanFactory getBeanFactory() throws IOException {
return new ClassPathXmlApplicationContext(DEFAULT_CONTEXT, CLASS);
}
@Test
void testDefaultExclusionPrefix() throws Exception {
DefaultAdvisorAutoProxyCreator aapc = (DefaultAdvisorAutoProxyCreator) getBeanFactory().getBean(ADVISOR_APC_BEAN_NAME);
assertThat(aapc.getAdvisorBeanNamePrefix()).isEqualTo((ADVISOR_APC_BEAN_NAME + DefaultAdvisorAutoProxyCreator.SEPARATOR));
assertThat(aapc.isUsePrefix()).isFalse();
}
/**
* If no pointcuts match (no attrs) there should be proxying.
*/
@Test
void testNoProxy() throws Exception {
BeanFactory bf = getBeanFactory();
Object o = bf.getBean("noSetters");
assertThat(AopUtils.isAopProxy(o)).isFalse();
}
@Test
void testTxIsProxied() throws Exception {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
assertThat(AopUtils.isAopProxy(test)).isTrue();
}
@Test
void testRegexpApplied() throws Exception {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
MethodCounter counter = (MethodCounter) bf.getBean("countingAdvice");
assertThat(counter.getCalls()).isEqualTo(0);
test.getName();
assertThat(counter.getCalls()).isEqualTo(1);
}
@Test
void testTransactionAttributeOnMethod() throws Exception {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
OrderedTxCheckAdvisor txc = (OrderedTxCheckAdvisor) bf.getBean("orderedBeforeTransaction");
assertThat(txc.getCountingBeforeAdvice().getCalls()).isEqualTo(0);
assertThat(txMan.commits).isEqualTo(0);
assertThat(test.getAge()).as("Initial value was correct").isEqualTo(4);
int newAge = 5;
test.setAge(newAge);
assertThat(txc.getCountingBeforeAdvice().getCalls()).isEqualTo(1);
assertThat(test.getAge()).as("New value set correctly").isEqualTo(newAge);
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
}
/**
* Should not roll back on servlet exception.
*/
@Test
void testRollbackRulesOnMethodCauseRollback() throws Exception {
BeanFactory bf = getBeanFactory();
Rollback rb = (Rollback) bf.getBean("rollback");
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
OrderedTxCheckAdvisor txc = (OrderedTxCheckAdvisor) bf.getBean("orderedBeforeTransaction");
assertThat(txc.getCountingBeforeAdvice().getCalls()).isEqualTo(0);
assertThat(txMan.commits).isEqualTo(0);
rb.echoException(null);
// Fires only on setters
assertThat(txc.getCountingBeforeAdvice().getCalls()).isEqualTo(0);
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
assertThat(txMan.rollbacks).isEqualTo(0);
Exception ex = new Exception();
try {
rb.echoException(ex);
}
catch (Exception actual) {
assertThat(actual).isEqualTo(ex);
}
assertThat(txMan.rollbacks).as("Transaction counts match").isEqualTo(1);
}
@Test
void testRollbackRulesOnMethodPreventRollback() throws Exception {
BeanFactory bf = getBeanFactory();
Rollback rb = (Rollback) bf.getBean("rollback");
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
assertThat(txMan.commits).isEqualTo(0);
// Should NOT roll back on ServletException
try {
rb.echoException(new ServletException());
}
catch (ServletException ex) {
}
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
}
@Test
void testProgrammaticRollback() throws Exception {
BeanFactory bf = getBeanFactory();
Object bean = bf.getBean(TXMANAGER_BEAN_NAME);
boolean condition = bean instanceof CallCountingTransactionManager;
assertThat(condition).isTrue();
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
Rollback rb = (Rollback) bf.getBean("rollback");
assertThat(txMan.commits).isEqualTo(0);
rb.rollbackOnly(false);
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
assertThat(txMan.rollbacks).isEqualTo(0);
// Will cause rollback only
rb.rollbackOnly(true);
assertThat(txMan.rollbacks).isEqualTo(1);
}
}
@SuppressWarnings("serial")
class NeverMatchAdvisor extends StaticMethodMatcherPointcutAdvisor {
public NeverMatchAdvisor() {
super(new NopInterceptor());
}
/**
* This method is solely to allow us to create a mixture of dependencies in
* the bean definitions. The dependencies don't have any meaning, and don't
* <b>do</b> anything.
*/
public void setDependencies(List<?> l) {
}
/**
* @see org.springframework.aop.MethodMatcher#matches(java.lang.reflect.Method, java.lang.Class)
*/
@Override
public boolean matches(Method m, @Nullable Class<?> targetClass) {
return false;
}
}
class NoSetters {
public void A() {
}
public int getB() {
return -1;
}
}
@SuppressWarnings("serial")
class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implements InitializingBean {
/**
* Should we insist on the presence of a transaction attribute or refuse to accept one?
*/
private boolean requireTransactionContext = false;
public void setRequireTransactionContext(boolean requireTransactionContext) {
this.requireTransactionContext = requireTransactionContext;
}
public boolean isRequireTransactionContext() {
return requireTransactionContext;
}
public CountingBeforeAdvice getCountingBeforeAdvice() {
return (CountingBeforeAdvice) getAdvice();
}
@Override
public void afterPropertiesSet() throws Exception {
setAdvice(new TxCountingBeforeAdvice());
}
@Override
public boolean matches(Method method, @Nullable Class<?> targetClass) {
return method.getName().startsWith("setAge");
}
private class TxCountingBeforeAdvice extends CountingBeforeAdvice {
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
// do transaction checks
if (requireTransactionContext) {
TransactionInterceptor.currentTransactionStatus();
}
else {
try {
TransactionInterceptor.currentTransactionStatus();
throw new RuntimeException("Shouldn't have a transaction");
}
catch (NoTransactionException ex) {
// this is Ok
}
}
super.before(method, args, target);
}
}
}
class Rollback {
/**
* Inherits transaction attribute.
* Illustrates programmatic rollback.
*/
public void rollbackOnly(boolean rollbackOnly) {
if (rollbackOnly) {
setRollbackOnly();
}
}
/**
* Extracted in a protected method to facilitate testing
*/
protected void setRollbackOnly() {
TransactionInterceptor.currentTransactionStatus().setRollbackOnly();
}
/**
* @org.springframework.transaction.interceptor.RuleBasedTransaction ( timeout=-1 )
* @org.springframework.transaction.interceptor.RollbackRule ( "java.lang.Exception" )
* @org.springframework.transaction.interceptor.NoRollbackRule ( "ServletException" )
*/
public void echoException(Exception ex) throws Exception {
if (ex != null) {
throw ex;
}
}
}
@@ -1,231 +0,0 @@
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.framework.autoproxy;
import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException;
/**
* Integration tests for advice invocation order for advice configured via
* AspectJ auto-proxy support.
*
* @author Sam Brannen
* @since 5.2.7
* @see org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests
*/
class AspectJAutoProxyAdviceOrderIntegrationTests {
/**
* {@link After @After} advice declared as first <em>after</em> method in source code.
*/
@Nested
@SpringJUnitConfig(AfterAdviceFirstConfig.class)
@DirtiesContext
class AfterAdviceFirstTests {
@Test
void afterAdviceIsInvokedLast(@Autowired Echo echo, @Autowired AfterAdviceFirstAspect aspect) throws Exception {
assertThat(aspect.invocations).isEmpty();
assertThat(echo.echo(42)).isEqualTo(42);
assertThat(aspect.invocations).containsExactly("around - start", "before", "after returning", "after", "around - end");
aspect.invocations.clear();
assertThatException().isThrownBy(() -> echo.echo(new Exception()));
assertThat(aspect.invocations).containsExactly("around - start", "before", "after throwing", "after", "around - end");
}
}
/**
* This test class uses {@link AfterAdviceLastAspect} which declares its
* {@link After @After} advice as the last <em>after advice type</em> method
* in its source code.
*
* <p>On Java versions prior to JDK 7, we would have expected the {@code @After}
* advice method to be invoked before {@code @AfterThrowing} and
* {@code @AfterReturning} advice methods due to the AspectJ precedence
* rules implemented in
* {@link org.springframework.aop.aspectj.autoproxy.AspectJPrecedenceComparator}.
*/
@Nested
@SpringJUnitConfig(AfterAdviceLastConfig.class)
@DirtiesContext
class AfterAdviceLastTests {
@Test
void afterAdviceIsInvokedLast(@Autowired Echo echo, @Autowired AfterAdviceLastAspect aspect) throws Exception {
assertThat(aspect.invocations).isEmpty();
assertThat(echo.echo(42)).isEqualTo(42);
assertThat(aspect.invocations).containsExactly("around - start", "before", "after returning", "after", "around - end");
aspect.invocations.clear();
assertThatException().isThrownBy(() -> echo.echo(new Exception()));
assertThat(aspect.invocations).containsExactly("around - start", "before", "after throwing", "after", "around - end");
}
}
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
static class AfterAdviceFirstConfig {
@Bean
AfterAdviceFirstAspect echoAspect() {
return new AfterAdviceFirstAspect();
}
@Bean
Echo echo() {
return new Echo();
}
}
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
static class AfterAdviceLastConfig {
@Bean
AfterAdviceLastAspect echoAspect() {
return new AfterAdviceLastAspect();
}
@Bean
Echo echo() {
return new Echo();
}
}
static class Echo {
Object echo(Object obj) throws Exception {
if (obj instanceof Exception) {
throw (Exception) obj;
}
return obj;
}
}
/**
* {@link After @After} advice declared as first <em>after</em> method in source code.
*/
@Aspect
static class AfterAdviceFirstAspect {
List<String> invocations = new ArrayList<>();
@Pointcut("execution(* echo(*))")
void echo() {
}
@After("echo()")
void after() {
invocations.add("after");
}
@AfterReturning("echo()")
void afterReturning() {
invocations.add("after returning");
}
@AfterThrowing("echo()")
void afterThrowing() {
invocations.add("after throwing");
}
@Before("echo()")
void before() {
invocations.add("before");
}
@Around("echo()")
Object around(ProceedingJoinPoint joinPoint) throws Throwable {
invocations.add("around - start");
try {
return joinPoint.proceed();
}
finally {
invocations.add("around - end");
}
}
}
/**
* {@link After @After} advice declared as last <em>after</em> method in source code.
*/
@Aspect
static class AfterAdviceLastAspect {
List<String> invocations = new ArrayList<>();
@Pointcut("execution(* echo(*))")
void echo() {
}
@Around("echo()")
Object around(ProceedingJoinPoint joinPoint) throws Throwable {
invocations.add("around - start");
try {
return joinPoint.proceed();
}
finally {
invocations.add("around - end");
}
}
@Before("echo()")
void before() {
invocations.add("before");
}
@AfterReturning("echo()")
void afterReturning() {
invocations.add("after returning");
}
@AfterThrowing("echo()")
void afterThrowing() {
invocations.add("after throwing");
}
@After("echo()")
void after() {
invocations.add("after");
}
}
}
@@ -1,44 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import java.util.ArrayList;
import java.util.List;
public class Component {
private String name;
private List<Component> components = new ArrayList<>();
// mmm, there is no setter method for the 'components'
public void addComponent(Component component) {
this.components.add(component);
}
public List<Component> getComponents() {
return components;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -1,63 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.util.CollectionUtils;
import org.springframework.util.xml.DomUtils;
public class ComponentBeanDefinitionParser extends AbstractBeanDefinitionParser {
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
return parseComponentElement(element);
}
private static AbstractBeanDefinition parseComponentElement(Element element) {
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ComponentFactoryBean.class);
factory.addPropertyValue("parent", parseComponent(element));
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "component");
if (!CollectionUtils.isEmpty(childElements)) {
parseChildComponents(childElements, factory);
}
return factory.getBeanDefinition();
}
private static BeanDefinition parseComponent(Element element) {
BeanDefinitionBuilder component = BeanDefinitionBuilder.rootBeanDefinition(Component.class);
component.addPropertyValue("name", element.getAttribute("name"));
return component.getBeanDefinition();
}
private static void parseChildComponents(List<Element> childElements, BeanDefinitionBuilder factory) {
ManagedList<BeanDefinition> children = new ManagedList<>(childElements.size());
for (Element element : childElements) {
children.add(parseComponentElement(element));
}
factory.addPropertyValue("children", children);
}
}
@@ -1,81 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import java.util.List;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Costin Leau
*/
@TestInstance(Lifecycle.PER_CLASS)
class ComponentBeanDefinitionParserTests {
private final DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
@BeforeAll
void setUp() throws Exception {
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("component-config.xml", ComponentBeanDefinitionParserTests.class));
}
@AfterAll
void tearDown() {
bf.destroySingletons();
}
@Test
void testBionicBasic() {
Component cp = getBionicFamily();
assertThat("Bionic-1").isEqualTo(cp.getName());
}
@Test
void testBionicFirstLevelChildren() {
Component cp = getBionicFamily();
List<Component> components = cp.getComponents();
assertThat(2).isEqualTo(components.size());
assertThat("Mother-1").isEqualTo(components.get(0).getName());
assertThat("Rock-1").isEqualTo(components.get(1).getName());
}
@Test
void testBionicSecondLevelChildren() {
Component cp = getBionicFamily();
List<Component> components = cp.getComponents().get(0).getComponents();
assertThat(2).isEqualTo(components.size());
assertThat("Karate-1").isEqualTo(components.get(0).getName());
assertThat("Sport-1").isEqualTo(components.get(1).getName());
}
private Component getBionicFamily() {
return bf.getBean("bionic-family", Component.class);
}
}
@@ -1,56 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import java.util.List;
import org.springframework.beans.factory.FactoryBean;
public class ComponentFactoryBean implements FactoryBean<Component> {
private Component parent;
private List<Component> children;
public void setParent(Component parent) {
this.parent = parent;
}
public void setChildren(List<Component> children) {
this.children = children;
}
@Override
public Component getObject() throws Exception {
if (this.children != null && this.children.size() > 0) {
for (Component child : children) {
this.parent.addComponent(child);
}
}
return this.parent;
}
@Override
public Class<Component> getObjectType() {
return Component.class;
}
@Override
public boolean isSingleton() {
return true;
}
}
@@ -1,25 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
public class ComponentNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("component", new ComponentBeanDefinitionParser());
}
}
@@ -1,135 +0,0 @@
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cache.annotation;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.cache.CacheManager;
import org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor;
import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException;
/**
* Integration tests for the @EnableCaching annotation.
*
* @author Chris Beams
* @since 3.1
*/
@SuppressWarnings("resource")
class EnableCachingIntegrationTests {
@Test
void repositoryIsClassBasedCacheProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, ProxyTargetClassCachingConfig.class);
ctx.refresh();
assertCacheProxying(ctx);
assertThat(AopUtils.isCglibProxy(ctx.getBean(FooRepository.class))).isTrue();
}
@Test
void repositoryUsesAspectJAdviceMode() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, AspectJCacheConfig.class);
// this test is a bit fragile, but gets the job done, proving that an
// attempt was made to look up the AJ aspect. It's due to classpath issues
// in .integration-tests that it's not found.
assertThatException().isThrownBy(ctx::refresh)
.withMessageContaining("AspectJCachingConfiguration");
}
private void assertCacheProxying(AnnotationConfigApplicationContext ctx) {
FooRepository repo = ctx.getBean(FooRepository.class);
assertThat(isCacheProxy(repo)).isTrue();
}
private boolean isCacheProxy(FooRepository repo) {
if (AopUtils.isAopProxy(repo)) {
for (Advisor advisor : ((Advised)repo).getAdvisors()) {
if (advisor instanceof BeanFactoryCacheOperationSourceAdvisor) {
return true;
}
}
}
return false;
}
@Configuration
@EnableCaching(proxyTargetClass=true)
static class ProxyTargetClassCachingConfig {
@Bean
CacheManager mgr() {
return new NoOpCacheManager();
}
}
@Configuration
static class Config {
@Bean
FooRepository fooRepository() {
return new DummyFooRepository();
}
}
@Configuration
@EnableCaching(mode=AdviceMode.ASPECTJ)
static class AspectJCacheConfig {
@Bean
CacheManager cacheManager() {
return new NoOpCacheManager();
}
}
interface FooRepository {
List<Object> findAll();
}
@Repository
static class DummyFooRepository implements FooRepository {
@Override
@Cacheable("primary")
public List<Object> findAll() {
return Collections.emptyList();
}
}
}
@@ -1,401 +0,0 @@
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.context.annotation.jsr330;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Named;
import javax.inject.Singleton;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.ScopeMetadata;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.support.GenericWebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Mark Fisher
* @author Juergen Hoeller
* @author Chris Beams
*/
class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
private static final String DEFAULT_NAME = "default";
private static final String MODIFIED_NAME = "modified";
private ServletRequestAttributes oldRequestAttributes;
private ServletRequestAttributes newRequestAttributes;
private ServletRequestAttributes oldRequestAttributesWithSession;
private ServletRequestAttributes newRequestAttributesWithSession;
@BeforeEach
void setup() {
this.oldRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
this.newRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
MockHttpServletRequest oldRequestWithSession = new MockHttpServletRequest();
oldRequestWithSession.setSession(new MockHttpSession());
this.oldRequestAttributesWithSession = new ServletRequestAttributes(oldRequestWithSession);
MockHttpServletRequest newRequestWithSession = new MockHttpServletRequest();
newRequestWithSession.setSession(new MockHttpSession());
this.newRequestAttributesWithSession = new ServletRequestAttributes(newRequestWithSession);
}
@AfterEach
void reset() {
RequestContextHolder.setRequestAttributes(null);
}
@Test
void testPrototype() {
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("prototype");
assertThat(bean).isNotNull();
assertThat(context.isPrototype("prototype")).isTrue();
assertThat(context.isSingleton("prototype")).isFalse();
}
@Test
void testSingletonScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
assertThat(context.isSingleton("singleton")).isTrue();
assertThat(context.isPrototype("singleton")).isFalse();
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testSingletonScopeIgnoresProxyInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testSingletonScopeIgnoresProxyTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testRequestScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("request");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// but a newly retrieved bean should have the default name
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("request");
assertThat(bean2.getName()).isEqualTo(DEFAULT_NAME);
}
@Test
void testRequestScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
// should be dynamic proxy, implementing both interfaces
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
boolean condition = bean instanceof AnotherScopeTestInterface;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testRequestScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
// should be a class-based proxy
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
boolean condition = bean instanceof RequestScopedTestBean;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testSessionScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("session");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// but a newly retrieved bean should have the default name
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(DEFAULT_NAME);
}
@Test
void testSessionScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");
// should be dynamic proxy, implementing both interfaces
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
boolean condition = bean instanceof AnotherScopeTestInterface;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
IScopedTestBean bean2 = (IScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
bean2.setName(DEFAULT_NAME);
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void testSessionScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");
// should be a class-based proxy
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
boolean condition1 = bean instanceof ScopedTestBean;
assertThat(condition1).isTrue();
boolean condition = bean instanceof SessionScopedTestBean;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
IScopedTestBean bean2 = (IScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
bean2.setName(DEFAULT_NAME);
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
private ApplicationContext createContext(final ScopedProxyMode scopedProxyMode) {
GenericWebApplicationContext context = new GenericWebApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
scanner.setScopeMetadataResolver(definition -> {
ScopeMetadata metadata = new ScopeMetadata();
if (definition instanceof AnnotatedBeanDefinition) {
AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
for (String type : annDef.getMetadata().getAnnotationTypes()) {
if (type.equals(javax.inject.Singleton.class.getName())) {
metadata.setScopeName(BeanDefinition.SCOPE_SINGLETON);
break;
}
else if (annDef.getMetadata().getMetaAnnotationTypes(type).contains(javax.inject.Scope.class.getName())) {
metadata.setScopeName(type.substring(type.length() - 13, type.length() - 6).toLowerCase());
metadata.setScopedProxyMode(scopedProxyMode);
break;
}
else if (type.startsWith("javax.inject")) {
metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);
}
}
}
return metadata;
});
// Scan twice in order to find errors in the bean definition compatibility check.
scanner.scan(getClass().getPackage().getName());
scanner.scan(getClass().getPackage().getName());
context.registerAlias("classPathBeanDefinitionScannerJsr330ScopeIntegrationTests.SessionScopedTestBean", "session");
context.refresh();
return context;
}
public interface IScopedTestBean {
String getName();
void setName(String name);
}
public static abstract class ScopedTestBean implements IScopedTestBean {
private String name = DEFAULT_NAME;
@Override
public String getName() { return this.name; }
@Override
public void setName(String name) { this.name = name; }
}
@Named("prototype")
public static class PrototypeScopedTestBean extends ScopedTestBean {
}
@Named("singleton")
@Singleton
public static class SingletonScopedTestBean extends ScopedTestBean {
}
public interface AnotherScopeTestInterface {
}
@Named("request")
@RequestScoped
public static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
}
@Named
@SessionScoped
public static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
}
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@javax.inject.Scope
public @interface RequestScoped {
}
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@javax.inject.Scope
public @interface SessionScoped {
}
}
@@ -1,341 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.context.annotation.scope;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
import org.springframework.web.context.annotation.SessionScope;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.support.GenericWebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.context.annotation.ScopedProxyMode.DEFAULT;
import static org.springframework.context.annotation.ScopedProxyMode.INTERFACES;
import static org.springframework.context.annotation.ScopedProxyMode.NO;
import static org.springframework.context.annotation.ScopedProxyMode.TARGET_CLASS;
/**
* @author Mark Fisher
* @author Juergen Hoeller
* @author Chris Beams
* @author Sam Brannen
*/
class ClassPathBeanDefinitionScannerScopeIntegrationTests {
private static final String DEFAULT_NAME = "default";
private static final String MODIFIED_NAME = "modified";
private ServletRequestAttributes oldRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
private ServletRequestAttributes newRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
private ServletRequestAttributes oldRequestAttributesWithSession;
private ServletRequestAttributes newRequestAttributesWithSession;
@BeforeEach
void setup() {
MockHttpServletRequest oldRequestWithSession = new MockHttpServletRequest();
oldRequestWithSession.setSession(new MockHttpSession());
this.oldRequestAttributesWithSession = new ServletRequestAttributes(oldRequestWithSession);
MockHttpServletRequest newRequestWithSession = new MockHttpServletRequest();
newRequestWithSession.setSession(new MockHttpSession());
this.newRequestAttributesWithSession = new ServletRequestAttributes(newRequestWithSession);
}
@AfterEach
void reset() {
RequestContextHolder.resetRequestAttributes();
}
@Test
void singletonScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void singletonScopeIgnoresProxyInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(INTERFACES);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void singletonScopeIgnoresProxyTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(TARGET_CLASS);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// singleton bean, so name should be modified even after lookup
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("singleton");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void requestScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("request");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// but a newly retrieved bean should have the default name
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("request");
assertThat(bean2.getName()).isEqualTo(DEFAULT_NAME);
}
@Test
void requestScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
// should be dynamic proxy, implementing both interfaces
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
boolean condition = bean instanceof AnotherScopeTestInterface;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void requestScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
// should be a class-based proxy
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
boolean condition = bean instanceof RequestScopedTestBean;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributes);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void sessionScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("session");
// should not be a proxy
assertThat(AopUtils.isAopProxy(bean)).isFalse();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// not a proxy so this should not have changed
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
// but a newly retrieved bean should have the default name
ScopedTestBean bean2 = (ScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(DEFAULT_NAME);
}
@Test
void sessionScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");
// should be dynamic proxy, implementing both interfaces
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
boolean condition = bean instanceof AnotherScopeTestInterface;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
IScopedTestBean bean2 = (IScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
bean2.setName(DEFAULT_NAME);
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
@Test
void sessionScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");
// should be a class-based proxy
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
boolean condition1 = bean instanceof ScopedTestBean;
assertThat(condition1).isTrue();
boolean condition = bean instanceof SessionScopedTestBean;
assertThat(condition).isTrue();
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
RequestContextHolder.setRequestAttributes(newRequestAttributesWithSession);
// this is a proxy so it should be reset to default
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
bean.setName(MODIFIED_NAME);
IScopedTestBean bean2 = (IScopedTestBean) context.getBean("session");
assertThat(bean2.getName()).isEqualTo(MODIFIED_NAME);
bean2.setName(DEFAULT_NAME);
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
assertThat(bean.getName()).isEqualTo(MODIFIED_NAME);
}
private ApplicationContext createContext(ScopedProxyMode scopedProxyMode) {
GenericWebApplicationContext context = new GenericWebApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
scanner.setBeanNameGenerator((definition, registry) -> definition.getScope());
scanner.setScopedProxyMode(scopedProxyMode);
// Scan twice in order to find errors in the bean definition compatibility check.
scanner.scan(getClass().getPackage().getName());
scanner.scan(getClass().getPackage().getName());
context.refresh();
return context;
}
interface IScopedTestBean {
String getName();
void setName(String name);
}
static abstract class ScopedTestBean implements IScopedTestBean {
private String name = DEFAULT_NAME;
@Override
public String getName() { return this.name; }
@Override
public void setName(String name) { this.name = name; }
}
@Component
static class SingletonScopedTestBean extends ScopedTestBean {
}
interface AnotherScopeTestInterface {
}
@Component
@RequestScope(proxyMode = DEFAULT)
static class RequestScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
}
@Component
@SessionScope(proxyMode = DEFAULT)
static class SessionScopedTestBean extends ScopedTestBean implements AnotherScopeTestInterface {
}
}
@@ -1,710 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env;
import java.io.File;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jca.context.ResourceAdapterApplicationContext;
import org.springframework.jca.support.SimpleBootstrapContext;
import org.springframework.jca.work.SimpleTaskWorkManager;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.mock.env.MockPropertySource;
import org.springframework.mock.web.MockServletConfig;
import org.springframework.mock.web.MockServletContext;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AbstractRefreshableWebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.context.support.StandardServletEnvironment;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
import static org.springframework.context.ConfigurableApplicationContext.ENVIRONMENT_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DERIVED_DEV_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DERIVED_DEV_ENV_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_ENV_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.ENVIRONMENT_AWARE_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_ENV_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.TRANSITIVE_BEAN_NAME;
import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.XML_PATH;
/**
* System integration tests for container support of the {@link Environment} API.
*
* <p>
* Tests all existing BeanFactory and ApplicationContext implementations to ensure that:
* <ul>
* <li>a standard environment object is always present
* <li>a custom environment object can be set and retrieved against the factory/context
* <li>the {@link EnvironmentAware} interface is respected
* <li>the environment object is registered with the container as a singleton bean (if an
* ApplicationContext)
* <li>bean definition files (if any, and whether XML or @Configuration) are registered
* conditionally based on environment metadata
* </ul>
*
* @author Chris Beams
* @author Sam Brannen
* @see org.springframework.context.support.EnvironmentIntegrationTests
*/
@SuppressWarnings("resource")
public class EnvironmentSystemIntegrationTests {
private final ConfigurableEnvironment prodEnv = new StandardEnvironment();
private final ConfigurableEnvironment devEnv = new StandardEnvironment();
private final ConfigurableEnvironment prodWebEnv = new StandardServletEnvironment();
@BeforeEach
void setUp() {
prodEnv.setActiveProfiles(PROD_ENV_NAME);
devEnv.setActiveProfiles(DEV_ENV_NAME);
prodWebEnv.setActiveProfiles(PROD_ENV_NAME);
}
@Test
void genericApplicationContext_standardEnv() {
ConfigurableApplicationContext ctx = new GenericApplicationContext(newBeanFactoryWithEnvironmentAwareBean());
ctx.refresh();
assertHasStandardEnvironment(ctx);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
}
@Test
void genericApplicationContext_customEnv() {
GenericApplicationContext ctx = new GenericApplicationContext(newBeanFactoryWithEnvironmentAwareBean());
ctx.setEnvironment(prodEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodEnv);
}
@Test
void xmlBeanDefinitionReader_inheritsEnvironmentFromEnvironmentCapableBDR() {
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.setEnvironment(prodEnv);
new XmlBeanDefinitionReader(ctx).loadBeanDefinitions(XML_PATH);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void annotatedBeanDefinitionReader_inheritsEnvironmentFromEnvironmentCapableBDR() {
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.setEnvironment(prodEnv);
new AnnotatedBeanDefinitionReader(ctx).register(Config.class);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void classPathBeanDefinitionScanner_inheritsEnvironmentFromEnvironmentCapableBDR_scanProfileAnnotatedConfigClasses() {
// it's actually ConfigurationClassPostProcessor's Environment that gets the job done here.
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.setEnvironment(prodEnv);
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx);
scanner.scan("org.springframework.core.env.scan1");
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void classPathBeanDefinitionScanner_inheritsEnvironmentFromEnvironmentCapableBDR_scanProfileAnnotatedComponents() {
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.setEnvironment(prodEnv);
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx);
scanner.scan("org.springframework.core.env.scan2");
ctx.refresh();
assertThat(scanner.getEnvironment()).isEqualTo(ctx.getEnvironment());
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void genericXmlApplicationContext() {
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.load(XML_PATH);
ctx.refresh();
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodEnv);
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void classPathXmlApplicationContext() {
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(XML_PATH);
ctx.setEnvironment(prodEnv);
ctx.refresh();
assertEnvironmentBeanRegistered(ctx);
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void fileSystemXmlApplicationContext() throws IOException {
ClassPathResource xml = new ClassPathResource(XML_PATH);
File tmpFile = File.createTempFile("test", "xml");
FileCopyUtils.copy(xml.getFile(), tmpFile);
// strange - FSXAC strips leading '/' unless prefixed with 'file:'
ConfigurableApplicationContext ctx =
new FileSystemXmlApplicationContext(new String[] {"file:" + tmpFile.getPath()}, false);
ctx.setEnvironment(prodEnv);
ctx.refresh();
assertEnvironmentBeanRegistered(ctx);
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void annotationConfigApplicationContext_withPojos() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(EnvironmentAwareBean.class);
ctx.refresh();
assertEnvironmentAwareInvoked(ctx, prodEnv);
}
@Test
void annotationConfigApplicationContext_withProdEnvAndProdConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(ProdConfig.class);
ctx.refresh();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void annotationConfigApplicationContext_withProdEnvAndDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(DevConfig.class);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(TRANSITIVE_BEAN_NAME)).isFalse();
}
@Test
void annotationConfigApplicationContext_withDevEnvAndDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(devEnv);
ctx.register(DevConfig.class);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isTrue();
assertThat(ctx.containsBean(TRANSITIVE_BEAN_NAME)).isTrue();
}
@Test
void annotationConfigApplicationContext_withImportedConfigClasses() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(Config.class);
ctx.refresh();
assertEnvironmentAwareInvoked(ctx, prodEnv);
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(TRANSITIVE_BEAN_NAME)).isFalse();
}
@Test
void mostSpecificDerivedClassDrivesEnvironment_withDerivedDevEnvAndDerivedDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
StandardEnvironment derivedDevEnv = new StandardEnvironment();
derivedDevEnv.setActiveProfiles(DERIVED_DEV_ENV_NAME);
ctx.setEnvironment(derivedDevEnv);
ctx.register(DerivedDevConfig.class);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isTrue();
assertThat(ctx.containsBean(DERIVED_DEV_BEAN_NAME)).isTrue();
assertThat(ctx.containsBean(TRANSITIVE_BEAN_NAME)).isTrue();
}
@Test
void mostSpecificDerivedClassDrivesEnvironment_withDevEnvAndDerivedDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.setEnvironment(devEnv);
ctx.register(DerivedDevConfig.class);
ctx.refresh();
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(DERIVED_DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(TRANSITIVE_BEAN_NAME)).isFalse();
}
@Test
void annotationConfigApplicationContext_withProfileExpressionMatchOr() {
testProfileExpression(true, "p3");
}
@Test
void annotationConfigApplicationContext_withProfileExpressionMatchAnd() {
testProfileExpression(true, "p1", "p2");
}
@Test
void annotationConfigApplicationContext_withProfileExpressionNoMatchAnd() {
testProfileExpression(false, "p1");
}
@Test
void annotationConfigApplicationContext_withProfileExpressionNoMatchNone() {
testProfileExpression(false, "p4");
}
private void testProfileExpression(boolean expected, String... activeProfiles) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
StandardEnvironment environment = new StandardEnvironment();
environment.setActiveProfiles(activeProfiles);
ctx.setEnvironment(environment);
ctx.register(ProfileExpressionConfig.class);
ctx.refresh();
assertThat(ctx.containsBean("expressionBean")).isEqualTo(expected);
}
@Test
void webApplicationContext() {
GenericWebApplicationContext ctx = new GenericWebApplicationContext(newBeanFactoryWithEnvironmentAwareBean());
assertHasStandardServletEnvironment(ctx);
ctx.setEnvironment(prodWebEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodWebEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodWebEnv);
}
@Test
void xmlWebApplicationContext() {
AbstractRefreshableWebApplicationContext ctx = new XmlWebApplicationContext();
ctx.setConfigLocation("classpath:" + XML_PATH);
ctx.setEnvironment(prodWebEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodWebEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodWebEnv);
assertThat(ctx.containsBean(DEV_BEAN_NAME)).isFalse();
assertThat(ctx.containsBean(PROD_BEAN_NAME)).isTrue();
}
@Test
void staticApplicationContext() {
StaticApplicationContext ctx = new StaticApplicationContext();
assertHasStandardEnvironment(ctx);
registerEnvironmentBeanDefinition(ctx);
ctx.setEnvironment(prodEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodEnv);
}
@Test
void staticWebApplicationContext() {
StaticWebApplicationContext ctx = new StaticWebApplicationContext();
assertHasStandardServletEnvironment(ctx);
registerEnvironmentBeanDefinition(ctx);
ctx.setEnvironment(prodWebEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodWebEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodWebEnv);
}
@Test
void annotationConfigWebApplicationContext() {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.setEnvironment(prodWebEnv);
ctx.setConfigLocation(EnvironmentAwareBean.class.getName());
ctx.refresh();
assertHasEnvironment(ctx, prodWebEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodWebEnv);
}
@Test
void registerServletParamPropertySources_AbstractRefreshableWebApplicationContext() {
MockServletContext servletContext = new MockServletContext();
servletContext.addInitParameter("pCommon", "pCommonContextValue");
servletContext.addInitParameter("pContext1", "pContext1Value");
MockServletConfig servletConfig = new MockServletConfig(servletContext);
servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
servletConfig.addInitParameter("pConfig1", "pConfig1Value");
AbstractRefreshableWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.setConfigLocation(EnvironmentAwareBean.class.getName());
ctx.setServletConfig(servletConfig);
ctx.refresh();
ConfigurableEnvironment environment = ctx.getEnvironment();
assertThat(environment).isInstanceOf(StandardServletEnvironment.class);
MutablePropertySources propertySources = environment.getPropertySources();
assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)).isTrue();
assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)).isTrue();
// ServletConfig gets precedence
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonConfigValue");
assertThat(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)))
.isLessThan(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)));
// but all params are available
assertThat(environment.getProperty("pContext1")).isEqualTo("pContext1Value");
assertThat(environment.getProperty("pConfig1")).isEqualTo("pConfig1Value");
// Servlet* PropertySources have precedence over System* PropertySources
assertThat(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)))
.isLessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)));
// Replace system properties with a mock property source for convenience
MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME);
mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue");
mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value");
propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties);
// assert that servletconfig params resolve with higher precedence than sysprops
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonConfigValue");
assertThat(environment.getProperty("pSysProps1")).isEqualTo("pSysProps1Value");
}
@Test
void registerServletParamPropertySources_GenericWebApplicationContext() {
MockServletContext servletContext = new MockServletContext();
servletContext.addInitParameter("pCommon", "pCommonContextValue");
servletContext.addInitParameter("pContext1", "pContext1Value");
GenericWebApplicationContext ctx = new GenericWebApplicationContext();
ctx.setServletContext(servletContext);
ctx.refresh();
ConfigurableEnvironment environment = ctx.getEnvironment();
assertThat(environment).isInstanceOf(StandardServletEnvironment.class);
MutablePropertySources propertySources = environment.getPropertySources();
assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)).isTrue();
// ServletContext params are available
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonContextValue");
assertThat(environment.getProperty("pContext1")).isEqualTo("pContext1Value");
// Servlet* PropertySources have precedence over System* PropertySources
assertThat(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)))
.isLessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)));
// Replace system properties with a mock property source for convenience
MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME);
mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue");
mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value");
propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties);
// assert that servletcontext init params resolve with higher precedence than sysprops
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonContextValue");
assertThat(environment.getProperty("pSysProps1")).isEqualTo("pSysProps1Value");
}
@Test
void registerServletParamPropertySources_StaticWebApplicationContext() {
MockServletContext servletContext = new MockServletContext();
servletContext.addInitParameter("pCommon", "pCommonContextValue");
servletContext.addInitParameter("pContext1", "pContext1Value");
MockServletConfig servletConfig = new MockServletConfig(servletContext);
servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
servletConfig.addInitParameter("pConfig1", "pConfig1Value");
StaticWebApplicationContext ctx = new StaticWebApplicationContext();
ctx.setServletConfig(servletConfig);
ctx.refresh();
ConfigurableEnvironment environment = ctx.getEnvironment();
MutablePropertySources propertySources = environment.getPropertySources();
assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)).isTrue();
assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)).isTrue();
// ServletConfig gets precedence
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonConfigValue");
assertThat(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)))
.isLessThan(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)));
// but all params are available
assertThat(environment.getProperty("pContext1")).isEqualTo("pContext1Value");
assertThat(environment.getProperty("pConfig1")).isEqualTo("pConfig1Value");
// Servlet* PropertySources have precedence over System* PropertySources
assertThat(propertySources.precedenceOf(PropertySource.named(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)))
.isLessThan(propertySources.precedenceOf(PropertySource.named(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)));
// Replace system properties with a mock property source for convenience
MockPropertySource mockSystemProperties = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME);
mockSystemProperties.setProperty("pCommon", "pCommonSysPropsValue");
mockSystemProperties.setProperty("pSysProps1", "pSysProps1Value");
propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockSystemProperties);
// assert that servletconfig params resolve with higher precedence than sysprops
assertThat(environment.getProperty("pCommon")).isEqualTo("pCommonConfigValue");
assertThat(environment.getProperty("pSysProps1")).isEqualTo("pSysProps1Value");
}
@Test
void resourceAdapterApplicationContext() {
ResourceAdapterApplicationContext ctx = new ResourceAdapterApplicationContext(new SimpleBootstrapContext(new SimpleTaskWorkManager()));
assertHasStandardEnvironment(ctx);
registerEnvironmentBeanDefinition(ctx);
ctx.setEnvironment(prodEnv);
ctx.refresh();
assertHasEnvironment(ctx, prodEnv);
assertEnvironmentBeanRegistered(ctx);
assertEnvironmentAwareInvoked(ctx, prodEnv);
}
@Test
void abstractApplicationContextValidatesRequiredPropertiesOnRefresh() {
{
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.refresh();
}
{
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.getEnvironment().setRequiredProperties("foo", "bar");
assertThatExceptionOfType(MissingRequiredPropertiesException.class).isThrownBy(
ctx::refresh);
}
{
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.getEnvironment().setRequiredProperties("foo");
ctx.setEnvironment(new MockEnvironment().withProperty("foo", "fooValue"));
ctx.refresh(); // should succeed
}
}
private DefaultListableBeanFactory newBeanFactoryWithEnvironmentAwareBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
registerEnvironmentBeanDefinition(bf);
return bf;
}
private void registerEnvironmentBeanDefinition(BeanDefinitionRegistry registry) {
registry.registerBeanDefinition(ENVIRONMENT_AWARE_BEAN_NAME,
rootBeanDefinition(EnvironmentAwareBean.class).getBeanDefinition());
}
private void assertEnvironmentBeanRegistered(
ConfigurableApplicationContext ctx) {
// ensure environment is registered as a bean
assertThat(ctx.containsBean(ENVIRONMENT_BEAN_NAME)).isTrue();
}
private void assertHasStandardEnvironment(ApplicationContext ctx) {
Environment defaultEnv = ctx.getEnvironment();
assertThat(defaultEnv).isNotNull();
assertThat(defaultEnv).isInstanceOf(StandardEnvironment.class);
}
private void assertHasStandardServletEnvironment(WebApplicationContext ctx) {
// ensure a default servlet environment exists
Environment defaultEnv = ctx.getEnvironment();
assertThat(defaultEnv).isNotNull();
assertThat(defaultEnv).isInstanceOf(StandardServletEnvironment.class);
}
private void assertHasEnvironment(ApplicationContext ctx, Environment expectedEnv) {
// ensure the custom environment took
Environment actualEnv = ctx.getEnvironment();
assertThat(actualEnv).isNotNull();
assertThat(actualEnv).isEqualTo(expectedEnv);
// ensure environment is registered as a bean
assertThat(ctx.containsBean(ENVIRONMENT_BEAN_NAME)).isTrue();
}
private void assertEnvironmentAwareInvoked(ConfigurableApplicationContext ctx, Environment expectedEnv) {
assertThat(ctx.getBean(EnvironmentAwareBean.class).environment).isEqualTo(expectedEnv);
}
private static class EnvironmentAwareBean implements EnvironmentAware {
public Environment environment;
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
}
/**
* Mirrors the structure of beans and environment-specific config files in
* EnvironmentSystemIntegrationTests-context.xml
*/
@Configuration
@Import({DevConfig.class, ProdConfig.class})
static class Config {
@Bean
public EnvironmentAwareBean envAwareBean() {
return new EnvironmentAwareBean();
}
}
@Profile(DEV_ENV_NAME)
@Configuration
@Import(TransitiveConfig.class)
static class DevConfig {
@Bean
public Object devBean() {
return new Object();
}
}
@Profile(PROD_ENV_NAME)
@Configuration
static class ProdConfig {
@Bean
public Object prodBean() {
return new Object();
}
}
@Configuration
static class TransitiveConfig {
@Bean
public Object transitiveBean() {
return new Object();
}
}
@Profile(DERIVED_DEV_ENV_NAME)
@Configuration
static class DerivedDevConfig extends DevConfig {
@Bean
public Object derivedDevBean() {
return new Object();
}
}
@Profile("(p1 & p2) | p3")
@Configuration
static class ProfileExpressionConfig {
@Bean
public Object expressionBean() {
return new Object();
}
}
/**
* Constants used both locally and in scan* sub-packages
*/
public static class Constants {
public static final String XML_PATH = "org/springframework/core/env/EnvironmentSystemIntegrationTests-context.xml";
public static final String ENVIRONMENT_AWARE_BEAN_NAME = "envAwareBean";
public static final String PROD_BEAN_NAME = "prodBean";
public static final String DEV_BEAN_NAME = "devBean";
public static final String DERIVED_DEV_BEAN_NAME = "derivedDevBean";
public static final String TRANSITIVE_BEAN_NAME = "transitiveBean";
public static final String PROD_ENV_NAME = "prod";
public static final String DEV_ENV_NAME = "dev";
public static final String DERIVED_DEV_ENV_NAME = "derivedDev";
}
}
@@ -1,40 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.GenericApplicationContext;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
class PropertyPlaceholderConfigurerEnvironmentIntegrationTests {
@Test
@SuppressWarnings("deprecation")
void test() {
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.registerBeanDefinition("ppc",
rootBeanDefinition(org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.class)
.addPropertyValue("searchSystemEnvironment", false)
.getBeanDefinition());
ctx.refresh();
ctx.getBean("ppc");
ctx.close();
}
}
@@ -1,26 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env.scan1;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({ DevConfig.class, ProdConfig.class })
class Config {
}
@@ -1,32 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env.scan1;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Profile(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_ENV_NAME)
@Configuration
class DevConfig {
@Bean
public Object devBean() {
return new Object();
}
}
@@ -1,32 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env.scan1;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Profile(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_ENV_NAME)
@Configuration
class ProdConfig {
@Bean
public Object prodBean() {
return new Object();
}
}
@@ -1,25 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env.scan2;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@Profile(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_ENV_NAME)
@Component(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.DEV_BEAN_NAME)
class DevBean {
}
@@ -1,26 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.env.scan2;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@Profile(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_ENV_NAME)
@Component(org.springframework.core.env.EnvironmentSystemIntegrationTests.Constants.PROD_BEAN_NAME)
class ProdBean {
}
@@ -1,63 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.support;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.expression.MethodExecutor;
class Spr7538Tests {
@Test
void repro() throws Exception {
AlwaysTrueReleaseStrategy target = new AlwaysTrueReleaseStrategy();
BeanFactoryTypeConverter converter = new BeanFactoryTypeConverter();
StandardEvaluationContext context = new StandardEvaluationContext();
context.setTypeConverter(converter);
List<Foo> arguments = Collections.emptyList();
List<TypeDescriptor> paramDescriptors = new ArrayList<>();
Method method = AlwaysTrueReleaseStrategy.class.getMethod("checkCompleteness", List.class);
paramDescriptors.add(new TypeDescriptor(new MethodParameter(method, 0)));
List<TypeDescriptor> argumentTypes = new ArrayList<>();
argumentTypes.add(TypeDescriptor.forObject(arguments));
ReflectiveMethodResolver resolver = new ReflectiveMethodResolver();
MethodExecutor executor = resolver.resolve(context, target, "checkCompleteness", argumentTypes);
Object result = executor.execute(context, target, arguments);
System.out.println("Result: " + result);
}
static class AlwaysTrueReleaseStrategy {
public boolean checkCompleteness(List<Foo> messages) {
return true;
}
}
static class Foo{}
}
@@ -1,250 +0,0 @@
/*
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.scheduling.annotation;
import java.util.concurrent.atomic.AtomicInteger;
import org.aspectj.lang.annotation.Aspect;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.testfixture.EnabledForTestGroups;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.testfixture.CallCountingTransactionManager;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
/**
* Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may
* not work well with beans that have already been proxied for other reasons such
* as @Transactional or @Async processing.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.1
*/
@SuppressWarnings("resource")
@EnabledForTestGroups(LONG_RUNNING)
class ScheduledAndTransactionalAnnotationIntegrationTests {
@Test
void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, JdkProxyTxConfig.class, RepoConfigA.class);
assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(ctx::refresh)
.withCauseInstanceOf(IllegalStateException.class);
}
@Test
void succeedsWhenSubclassProxyAndScheduledMethodNotPresentOnInterface() throws InterruptedException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, SubclassProxyTxConfig.class, RepoConfigA.class);
ctx.refresh();
Thread.sleep(200); // allow @Scheduled method to be called several times
MyRepository repository = ctx.getBean(MyRepository.class);
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
assertThat(AopUtils.isCglibProxy(repository)).isTrue();
assertThat(repository.getInvocationCount()).isGreaterThan(0);
assertThat(txManager.commits).isGreaterThan(0);
}
@Test
void succeedsWhenJdkProxyAndScheduledMethodIsPresentOnInterface() throws InterruptedException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, JdkProxyTxConfig.class, RepoConfigB.class);
ctx.refresh();
Thread.sleep(200); // allow @Scheduled method to be called several times
MyRepositoryWithScheduledMethod repository = ctx.getBean(MyRepositoryWithScheduledMethod.class);
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
assertThat(AopUtils.isJdkDynamicProxy(repository)).isTrue();
assertThat(repository.getInvocationCount()).isGreaterThan(0);
assertThat(txManager.commits).isGreaterThan(0);
}
@Test
void withAspectConfig() throws InterruptedException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(AspectConfig.class, MyRepositoryWithScheduledMethodImpl.class);
ctx.refresh();
Thread.sleep(200); // allow @Scheduled method to be called several times
MyRepositoryWithScheduledMethod repository = ctx.getBean(MyRepositoryWithScheduledMethod.class);
assertThat(AopUtils.isCglibProxy(repository)).isTrue();
assertThat(repository.getInvocationCount()).isGreaterThan(0);
}
@Configuration
@EnableTransactionManagement
static class JdkProxyTxConfig {
}
@Configuration
@EnableTransactionManagement(proxyTargetClass = true)
static class SubclassProxyTxConfig {
}
@Configuration
static class RepoConfigA {
@Bean
MyRepository repository() {
return new MyRepositoryImpl();
}
}
@Configuration
static class RepoConfigB {
@Bean
MyRepositoryWithScheduledMethod repository() {
return new MyRepositoryWithScheduledMethodImpl();
}
}
@Configuration
@EnableScheduling
static class Config {
@Bean
PlatformTransactionManager txManager() {
return new CallCountingTransactionManager();
}
@Bean
PersistenceExceptionTranslator peTranslator() {
return mock(PersistenceExceptionTranslator.class);
}
@Bean
static PersistenceExceptionTranslationPostProcessor peTranslationPostProcessor() {
return new PersistenceExceptionTranslationPostProcessor();
}
}
@Configuration
@EnableScheduling
static class AspectConfig {
@Bean
static AnnotationAwareAspectJAutoProxyCreator autoProxyCreator() {
AnnotationAwareAspectJAutoProxyCreator apc = new AnnotationAwareAspectJAutoProxyCreator();
apc.setProxyTargetClass(true);
return apc;
}
@Bean
static MyAspect myAspect() {
return new MyAspect();
}
}
@Aspect
public static class MyAspect {
private final AtomicInteger count = new AtomicInteger();
@org.aspectj.lang.annotation.Before("execution(* scheduled())")
public void checkTransaction() {
this.count.incrementAndGet();
}
}
public interface MyRepository {
int getInvocationCount();
}
@Repository
static class MyRepositoryImpl implements MyRepository {
private final AtomicInteger count = new AtomicInteger();
@Transactional
@Scheduled(fixedDelay = 5)
public void scheduled() {
this.count.incrementAndGet();
}
@Override
public int getInvocationCount() {
return this.count.get();
}
}
public interface MyRepositoryWithScheduledMethod {
int getInvocationCount();
void scheduled();
}
@Repository
static class MyRepositoryWithScheduledMethodImpl implements MyRepositoryWithScheduledMethod {
private final AtomicInteger count = new AtomicInteger();
@Autowired(required = false)
private MyAspect myAspect;
@Override
@Transactional
@Scheduled(fixedDelay = 5)
public void scheduled() {
this.count.incrementAndGet();
}
@Override
public int getInvocationCount() {
if (this.myAspect != null) {
assertThat(this.myAspect.count.get()).isEqualTo(this.count.get());
}
return this.count.get();
}
}
}
@@ -1,331 +0,0 @@
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.transaction.annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor;
import org.springframework.transaction.testfixture.CallCountingTransactionManager;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException;
/**
* Integration tests for the @EnableTransactionManagement annotation.
*
* @author Chris Beams
* @author Sam Brannen
* @since 3.1
*/
@SuppressWarnings("resource")
class EnableTransactionManagementIntegrationTests {
@Test
void repositoryIsNotTxProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
assertThat(isTxProxy(ctx.getBean(FooRepository.class))).isFalse();
}
@Test
void repositoryIsTxProxy_withDefaultTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class, DefaultTxManagerNameConfig.class);
assertTxProxying(ctx);
}
@Test
void repositoryIsTxProxy_withCustomTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class, CustomTxManagerNameConfig.class);
assertTxProxying(ctx);
}
@Test
void repositoryIsTxProxy_withNonConventionalTxManagerName_fallsBackToByTypeLookup() {
assertTxProxying(new AnnotationConfigApplicationContext(Config.class, NonConventionalTxManagerNameConfig.class));
}
@Test
void repositoryIsClassBasedTxProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class, ProxyTargetClassTxConfig.class);
assertTxProxying(ctx);
assertThat(AopUtils.isCglibProxy(ctx.getBean(FooRepository.class))).isTrue();
}
@Test
void repositoryUsesAspectJAdviceMode() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, AspectJTxConfig.class);
// this test is a bit fragile, but gets the job done, proving that an
// attempt was made to look up the AJ aspect. It's due to classpath issues
// in .integration-tests that it's not found.
assertThatException()
.isThrownBy(ctx::refresh)
.withMessageContaining("AspectJJtaTransactionManagementConfiguration");
}
@Test
void implicitTxManager() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImplicitTxManagerConfig.class);
FooRepository fooRepository = ctx.getBean(FooRepository.class);
fooRepository.findAll();
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
assertThat(txManager.begun).isEqualTo(1);
assertThat(txManager.commits).isEqualTo(1);
assertThat(txManager.rollbacks).isEqualTo(0);
}
@Test
void explicitTxManager() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ExplicitTxManagerConfig.class);
FooRepository fooRepository = ctx.getBean(FooRepository.class);
fooRepository.findAll();
CallCountingTransactionManager txManager1 = ctx.getBean("txManager1", CallCountingTransactionManager.class);
assertThat(txManager1.begun).isEqualTo(1);
assertThat(txManager1.commits).isEqualTo(1);
assertThat(txManager1.rollbacks).isEqualTo(0);
CallCountingTransactionManager txManager2 = ctx.getBean("txManager2", CallCountingTransactionManager.class);
assertThat(txManager2.begun).isEqualTo(0);
assertThat(txManager2.commits).isEqualTo(0);
assertThat(txManager2.rollbacks).isEqualTo(0);
}
@Test
void apcEscalation() {
new AnnotationConfigApplicationContext(EnableTxAndCachingConfig.class);
}
private void assertTxProxying(AnnotationConfigApplicationContext ctx) {
FooRepository repo = ctx.getBean(FooRepository.class);
assertThat(isTxProxy(repo)).isTrue();
// trigger a transaction
repo.findAll();
}
private boolean isTxProxy(FooRepository repo) {
if (!AopUtils.isAopProxy(repo)) {
return false;
}
return Arrays.stream(((Advised) repo).getAdvisors())
.anyMatch(BeanFactoryTransactionAttributeSourceAdvisor.class::isInstance);
}
@Configuration
@EnableTransactionManagement
@ImportResource("org/springframework/transaction/annotation/enable-caching.xml")
static class EnableTxAndCachingConfig {
@Bean
public PlatformTransactionManager txManager() {
return new CallCountingTransactionManager();
}
@Bean
public FooRepository fooRepository() {
return new DummyFooRepository();
}
@Bean
public CacheManager cacheManager() {
SimpleCacheManager mgr = new SimpleCacheManager();
ArrayList<Cache> caches = new ArrayList<>();
caches.add(new ConcurrentMapCache(""));
mgr.setCaches(caches);
return mgr;
}
}
@Configuration
@EnableTransactionManagement
static class ImplicitTxManagerConfig {
@Bean
public PlatformTransactionManager txManager() {
return new CallCountingTransactionManager();
}
@Bean
public FooRepository fooRepository() {
return new DummyFooRepository();
}
}
@Configuration
@EnableTransactionManagement
static class ExplicitTxManagerConfig implements TransactionManagementConfigurer {
@Bean
public PlatformTransactionManager txManager1() {
return new CallCountingTransactionManager();
}
@Bean
public PlatformTransactionManager txManager2() {
return new CallCountingTransactionManager();
}
@Override
public PlatformTransactionManager annotationDrivenTransactionManager() {
return txManager1();
}
@Bean
public FooRepository fooRepository() {
return new DummyFooRepository();
}
}
@Configuration
@EnableTransactionManagement
static class DefaultTxManagerNameConfig {
@Bean
PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
@Configuration
@EnableTransactionManagement
static class CustomTxManagerNameConfig {
@Bean
PlatformTransactionManager txManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
@Configuration
@EnableTransactionManagement
static class NonConventionalTxManagerNameConfig {
@Bean
PlatformTransactionManager txManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
@Configuration
@EnableTransactionManagement(proxyTargetClass=true)
static class ProxyTargetClassTxConfig {
@Bean
PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
@Configuration
@EnableTransactionManagement(mode=AdviceMode.ASPECTJ)
static class AspectJTxConfig {
@Bean
PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
@Configuration
static class Config {
@Bean
FooRepository fooRepository() {
JdbcFooRepository repos = new JdbcFooRepository();
repos.setDataSource(dataSource());
return repos;
}
@Bean
DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.HSQL)
.build();
}
}
interface FooRepository {
List<Object> findAll();
}
@Repository
static class JdbcFooRepository implements FooRepository {
public void setDataSource(DataSource dataSource) {
}
@Override
@Transactional
public List<Object> findAll() {
return Collections.emptyList();
}
}
@Repository
static class DummyFooRepository implements FooRepository {
@Override
@Transactional
public List<Object> findAll() {
return Collections.emptyList();
}
}
}
@@ -1,129 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.transaction.annotation;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests proving that regardless the proxy strategy used (JDK interface-based vs. CGLIB
* subclass-based), discovery of advice-oriented annotations is consistent.
*
* For example, Spring's @Transactional may be declared at the interface or class level,
* and whether interface or subclass proxies are used, the @Transactional annotation must
* be discovered in a consistent fashion.
*
* @author Chris Beams
*/
@SuppressWarnings("resource")
class ProxyAnnotationDiscoveryTests {
@Test
void annotatedServiceWithoutInterface_PTC_true() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCTrue.class, AnnotatedServiceWithoutInterface.class);
ctx.refresh();
AnnotatedServiceWithoutInterface s = ctx.getBean(AnnotatedServiceWithoutInterface.class);
assertThat(AopUtils.isCglibProxy(s)).isTrue();
assertThat(s).isInstanceOf(AnnotatedServiceWithoutInterface.class);
}
@Test
void annotatedServiceWithoutInterface_PTC_false() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCFalse.class, AnnotatedServiceWithoutInterface.class);
ctx.refresh();
AnnotatedServiceWithoutInterface s = ctx.getBean(AnnotatedServiceWithoutInterface.class);
assertThat(AopUtils.isCglibProxy(s)).isTrue();
assertThat(s).isInstanceOf(AnnotatedServiceWithoutInterface.class);
}
@Test
void nonAnnotatedService_PTC_true() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCTrue.class, AnnotatedServiceImpl.class);
ctx.refresh();
NonAnnotatedService s = ctx.getBean(NonAnnotatedService.class);
assertThat(AopUtils.isCglibProxy(s)).isTrue();
assertThat(s).isInstanceOf(AnnotatedServiceImpl.class);
}
@Test
void nonAnnotatedService_PTC_false() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCFalse.class, AnnotatedServiceImpl.class);
ctx.refresh();
NonAnnotatedService s = ctx.getBean(NonAnnotatedService.class);
assertThat(AopUtils.isJdkDynamicProxy(s)).isTrue();
assertThat(s).isNotInstanceOf(AnnotatedServiceImpl.class);
}
@Test
void annotatedService_PTC_true() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCTrue.class, NonAnnotatedServiceImpl.class);
ctx.refresh();
AnnotatedService s = ctx.getBean(AnnotatedService.class);
assertThat(AopUtils.isCglibProxy(s)).isTrue();
assertThat(s).isInstanceOf(NonAnnotatedServiceImpl.class);
}
@Test
void annotatedService_PTC_false() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCFalse.class, NonAnnotatedServiceImpl.class);
ctx.refresh();
AnnotatedService s = ctx.getBean(AnnotatedService.class);
assertThat(AopUtils.isJdkDynamicProxy(s)).isTrue();
assertThat(s).isNotInstanceOf(NonAnnotatedServiceImpl.class);
}
}
@Configuration
@EnableTransactionManagement(proxyTargetClass=false)
class PTCFalse { }
@Configuration
@EnableTransactionManagement(proxyTargetClass=true)
class PTCTrue { }
interface NonAnnotatedService {
void m();
}
interface AnnotatedService {
@Transactional void m();
}
class NonAnnotatedServiceImpl implements AnnotatedService {
@Override
public void m() { }
}
class AnnotatedServiceImpl implements NonAnnotatedService {
@Override
@Transactional public void m() { }
}
class AnnotatedServiceWithoutInterface {
@Transactional public void m() { }
}
@@ -1 +0,0 @@
http\://www.foo.example/schema/component=org.springframework.beans.factory.xml.ComponentNamespaceHandler
@@ -1 +0,0 @@
http\://www.foo.example/schema/component/component.xsd=org/springframework/beans/factory/xml/component.xsd
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{1.} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="echo" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$Echo"/>
<bean id="invocationTrackingAspect" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$InvocationTrackingAspect" />
<aop:config>
<aop:aspect id="echoAdvice" ref="invocationTrackingAspect">
<aop:pointcut id="echoMethod" expression="execution(* echo(*))" />
<aop:around method="around" pointcut-ref="echoMethod" />
<aop:before method="before" pointcut-ref="echoMethod" />
<aop:after method="after" pointcut-ref="echoMethod" />
<aop:after-throwing method="afterThrowing" pointcut-ref="echoMethod" />
<aop:after-returning method="afterReturning" pointcut-ref="echoMethod" />
</aop:aspect>
</aop:config>
</beans>

Some files were not shown because too many files have changed in this diff Show More