Commit Graph

280 Commits (e23c92802f522db9afc3179b77b1a61d0523baa8)

Author SHA1 Message Date
Stephane Nicoll 20da9826cc Disable incrementalBuildTypeRenamed test
This commit disables a test that does not test what it is supposed to
and improve the Metadata assertions to fail early if more than one
matching item by name and type is found in the metadata.

See gh-26271
4 years ago
Andy Wilkinson 340893747b Merge branch '2.4.x'
Closes gh-25799
4 years ago
Andy Wilkinson af7e4e211c Support all known endpoint types
Previously, the configuration metadata annotation processor only
declared support for `@Endpoint` and none of the other more
specialized `@…Endpoint` annotations that are meta-annotated with
`@Endpoint` such as `@WebEndpoint` and `@JmxEndpoint. This would
result in missing metadata if a full or incremental build only
compiled classes annotated with one of the more specialized
`@…Endpoint` annotations as the annotation processor would not be
called.

This commit updates the processor's supported annotation types to
include every known `@…Endpoint` annotation. The test processor has
also been similarly updated to align its behaviour with that of the
main processor.

Fixes gh-25388
4 years ago
Andy Wilkinson db781a0d84 Merge branch '2.4.x'
See gh-25077
4 years ago
Andy Wilkinson 788a42d694 Merge branch '2.3.x' into 2.4.x
See gh-25076
4 years ago
Andy Wilkinson 67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
4 years ago
Phillip Webb d8b6960997 Merge branch '2.4.x'
Closes gh-25077
4 years ago
Phillip Webb 257608a3a3 Merge branch '2.3.x' into 2.4.x
Closes gh-25076
4 years ago
Phillip Webb 939b5dfc26 Add junit-platform-launcher dependency
Update `build.gradle` files to ensure that `junit-platform-launcher` is
a `testRuntimeOnly` dependency. This ensures that tests can be run from
Eclipse.

Closes gh-25074
4 years ago
Marten Deinum 5121ca5d17 Reduce the overhead of char[] creation
See gh-24204
4 years ago
Stephane Nicoll 946be4eab6 Merge branch '2.3.x'
Closes gh-24059
4 years ago
Stephane Nicoll 4a8646bd09 Merge branch '2.2.x' into 2.3.x
Closes gh-24058
4 years ago
Stephane Nicoll 59ea7c11f6 Use most specific getter when generating metadata
This commit makes sure to use the most specific getter if more than
one candidate exists.

Closes gh-24002
4 years ago
izeye 9c35cd41ad Polish
See gh-23986
4 years ago
Phillip Webb a41ff4dfab Merge branch '2.3.x' 4 years ago
Phillip Webb b0c2687aa9 Update copyright year of changed files 4 years ago
Andy Wilkinson 5642dc6d13 Merge branch '2.3.x'
Closes gh-23970
4 years ago
Andy Wilkinson 70d9602b3f Merge branch '2.2.x' into 2.3.x
Closes gh-23969
4 years ago
Andy Wilkinson e7eb7739dc Use overriding rather than overridden getter methods in config prop AP
Fixes gh-23966
4 years ago
Phillip Webb 74e06e8e6a Refine MetadataCollector logic
Update `MetadataCollector` merge logic so that previous items are no
longer added if the current round contains a property of the same name.

Fixes gh-23916
4 years ago
Phillip Webb 23e5fd798c Merge branch '2.3.x'
Closes gh-23960
4 years ago
Phillip Webb b86dcbec72 Merge branch '2.2.x' into 2.3.x
Closes gh-23959
4 years ago
Phillip Webb cf09451ffb Retain inner-class data on incremental compile
Ensure that metadata sourced from inner-types is not deleted when
performing an incremental compile. Prior to this commit, the source
type was searched using the `Outer$Inner` format. This is not supported
`Elements.getTypeElement` so we now convert the names to `Outer.Inner`.

Closes gh-10886
4 years ago
Stephane Nicoll 1296b4dfe6 Revert "Support constructor binding on 3rd party classes"
This commit reverts the support of constructor binding on 3rd party
classes using @ImportConfigurationPropertiesBean

See gh-23172

Closes gh-23593
4 years ago
Andy Wilkinson c82581171d Trigger configuration properties annotation processsor on `@Endpoint`
We generate metadata for `@Endpoint` annotated types so the annotation
processor need to indicate that it supports the endpoint annotation.

See gh-23580
4 years ago
Andy Wilkinson 1924aad07c Limit supported annotations to `@ConfigurationProperties` and `@Configuration`
Previously, the configuration property annotation processor declared
that it supported all annotation types. This hurt performance and
prevented incremental builds with Gradle when compiling source code
containing source-retention annotations.

This commit updates its supported annotation types to be only
`@ConfigurationProperties` and `@Configuration`. The latter is declared
to allow binding third-party classes returned from a `@Bean` method.

Fixes gh-23580
4 years ago
Stephane Nicoll 5feaf2bc1a Polish "Polish empty string checks"
See gh-23550
4 years ago
Santhoshkumar. P 5cb07e292d Polish empty string checks
See gh-23550
4 years ago
Phillip Webb 5f49d4a8d7 Rename @ConfigurationPropertiesImport
Rename `@ConfigurationPropertiesImport` to
`@ImportAsConfigurationPropertiesBean` and also refine the registrar
so that it can be used with type directly annotated with
`@ConfigurationProperties`.

Closes gh-23172
4 years ago
Phillip Webb c857a743a0 Rename @ImportConfigurationPropertiesBean
Rename `@ImportConfigurationPropertiesBean` to
`@ConfigurationPropertiesImport`.

Closes gh-23172
4 years ago
dreis2211 be56cac2bb Note starters' and annotation processors' jar type in their manifest
See gh-22203
4 years ago
Phillip Webb f260c77fe3 Add @ImportConfigurationPropertiesBean support
Add repeatable `@ImportConfigurationPropertiesBean` annotation that can
be used to import types and treat them as `@ConfigurationProperties`
beans. This annotation is specifically designed to support third-party
classes that can't contain any Spring annotations.

Closes gh-23172
4 years ago
Andy Wilkinson 56ded38f5d Generate default values from Duration and Period .ZERO
Closes gh-23082
4 years ago
Stephane Nicoll dac63fc3e5 Polish 4 years ago
Phillip Webb 33b48c8bac Add @Name support to the annotation processor
Update the `ConfigurationMetadataAnnotationProcessor` so that `@Name`
annotated parameters generate the correct meta-data.

Closes gh-22492
4 years ago
Andy Wilkinson 62aa8ce107 Support incremental annotation processing with Gradle
Closes gh-22150
4 years ago
Phillip Webb 82ed255bb1 Merge branch '2.3.x'
Closes gh-22060
4 years ago
Phillip Webb 9843888714 Merge branch '2.2.x' into 2.3.x
Closes gh-22059
4 years ago
Phillip Webb 3b3a49db1f Polish 'Fix infinite loop in FieldValues'
See gh-22040
4 years ago
Konrado85 39a853c57b Fix infinite loop in FieldValues
Update `FieldValues` test object so that it doesn't cause an infinite
loop if it is actually created.

See gh-22040
4 years ago
Andy Wilkinson 47874d8c6a Treat warnings as errors when compiling
See gh-21271
4 years ago
Phillip Webb 0a05b4c9fd Update copyright year of changed files 5 years ago
Phillip Webb 5ae623c43a Polish 'Add Period converter support'
Polish period converter support, primarily by changing
`PeriodStyle` to parse and print periods that include
more than one unit.

See gh-21136
5 years ago
Grubhart dc4d71f91e Add Period converter support
Add converter support for `javax.time.Period` including:

	String -> Period
	Number -> Period
	Period -> String

Period to Number conversion is not supported since `Period` has no
ability to deduce the number of calendar days in the period.

See gh-21136
5 years ago
Phillip Webb ad1248e4ec Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder"

Closes gh-21218
5 years ago
Phillip Webb bf41da5322 Update copyright year of changed files 5 years ago
Stephane Nicoll 692885f71e Merge branch '2.2.x'
Closes gh-21049
5 years ago
Stephane Nicoll 8cbd7f5cd0 Polish "Add support for initializing nested object when nothing bound"
This commit harmonizes the change made to @DefaultValue to the
annotation processor. If such annotation is added to a scalar value with
no value at all, no default value is produced.

Closes gh-18917
5 years ago
Phillip Webb 3ca896e63f Polish 5 years ago
dreis2211 9588188800 Use isEmpty() where possible
See gh-20370
5 years ago
Stephane Nicoll 95be419527 Use Class.forName rather than ClassLoader.loadClass
This commit changes uses of ClassLoader.loadClass to Class.forName for
consistency with what was initiated in #19342 and better compatibility
with GraalVM.

Closes gh-19824
5 years ago
Phillip Webb e0013454b5 Use parentheses when declaring dependencies
Update all dependencies declarations to use the form `scope(reference)`
rather than `scope reference`.

Prior to this commit we declared dependencies without parentheses unless
we were forced to add them due to an `exclude`.
5 years ago
Phillip Webb 0209cd3e4c Polish quote form used in Gradle scripts
Replace Gradle single quote strings with the double quote form
whenever possible. The change helps to being consistency to the
dependencies section where mostly single quotes were used, but
occasionally double quotes were required due to `${}` references.
5 years ago
Andy Wilkinson ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
5 years ago
Stephane Nicoll 2c1e81adf0 Polish 5 years ago
Stephane Nicoll b3643965f0 Polish "Detect config props using builder pattern and generics"
See gh-19099
5 years ago
如梦技术 743f4a4cb1 Detect config props using builder pattern and generics
See gh-19099
5 years ago
Phillip Webb 26ff18f37d Merge branch '2.1.x' into 2.2.x 5 years ago
Phillip Webb accd830dd5 Update copyright header of changed files 5 years ago
Andy Wilkinson f1af8c5510 Merge branch '2.1.x'
Closes gh-18889
5 years ago
Andy Wilkinson 59bc3c5602 Prevent recursive config props from causing a stack overflow
Previously, when the configuration properties annotation processor
encountered a property that was the same as an outer type that had
already been processed, it would fail with a stack overflow error.

This commit introduces the use of a stack to track the types that
have been processed. Types that have been seen before are skipped,
thereby preventing a failure from occurring. We do not fail upon
encountering a recursive type to allow metadata generation to
complete. At runtime, the recursive property will not cause a problem
if it is not bound.

Fixes gh-18365
5 years ago
Johnny Lim 45d85778b8 Polish
See gh-18838
5 years ago
Stephane Nicoll d6d32ec01d Polish 5 years ago
Phillip Webb 386c0a60a7 Relax @ConstructorBinding member class requirement
Update `@ConfigurationProperties` so that `@ConstructorBinding` classes
no longer need to repeat the annotation for their members.

Closes gh-18481
5 years ago
Stephane Nicoll 45f6668d03 Use @ConstructorBinding when generating meta-data
Update the configuration processor to use the newly introduced
`@ConstructorBinding` annotation to determine when meta data
should be generated from constructor parameters.

Prior to this commit, the processor had no good way to tell when
constructor parameters should be used instead of getters/setters.

Closes gh-17035
5 years ago
Andy Wilkinson 46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
5 years ago
Andy Wilkinson 3d4157ad6d Correct SCM URLs in published poms
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.

This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.

Fixes gh-18328
5 years ago
Stephane Nicoll 39fed4a9d9 Fix binding detection of ConfigurationProperties contributed by @Bean
This commit makes sure that a ConfigurationProperties type contributed
by a `@Bean` factory method uses properties binding regardless of the
presence of a matching constructor.

`@Bean` method makes sure the user is in control and will be responsible
of creating the instance. As a result, binding of properties will not
happen there and therefore can only happen with regular JavaBean
accessors.

Closes gh-18184
5 years ago
Andy Wilkinson 4b5ebd8505 Process all non-private methods, not just public methods
Previously, the configuration processor would ignore any
@ConfigurationProperties-annotated methods that were not public. This
prevented metadata generation for package-private @Bean methods such
as those in DataSourceConfiguration's inner-classes for DBCP2, Hikari,
and Tomcat JDBC.

This commit updates the annotation processor so that it will process
any non-private method annotated with @ConfigurationProperties.

Fixes gh-18124
5 years ago
dreis2211 b4350a9d96 Remove unnecessary blank lines
See gh-18089
5 years ago
Andy Wilkinson a4b8d2401f Merge branch '2.1.x'
Closes gh-18094
5 years ago
Andy Wilkinson abba4fa9c9 Include exception's message in message printed by AP
Fixes gh-17974
5 years ago
Andy Wilkinson b463acb10f Merge branch '2.1.x'
Closes gh-18093
5 years ago
Andy Wilkinson edcaee375f Consider @Deprecated on field when determining property's deprecation
Fixes gh-17550
5 years ago
Andy Wilkinson ab87b2a39b Polish 5 years ago
Stephane Nicoll 1c8f727864 Polish "Simplify if statements"
See gh-17785
5 years ago
SaberXu c6c3a91f8d Simplify if statements
See gh-17785
5 years ago
Phillip Webb 2cdceb92bf Polish 5 years ago
Phillip Webb 8bc780762a Merge branch '2.1.x' 5 years ago
Phillip Webb fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb 913e831f4e Merge '1.5.x' into 2.0.x 5 years ago
Phillip Webb 01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
5 years ago
Phillip Webb a66c4d3096 Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
5 years ago
Phillip Webb 605599138e Merge branch '2.1.x' 5 years ago
Phillip Webb 92bff3c328 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb cfeb0239b7 Merge branch '1.5.x' into 2.0.x 5 years ago
Stephane Nicoll e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
5 years ago
Andy Wilkinson cffc870fd6 Fix test failures on Windows
Since the move to JUnit 5, a number of tests were failing on Windows.
The majority were failing due to open file handles preventing the
clean up of the tests' temporary directory. This commit addresses
these failures by updating the tests to close JarFiles, InputStreams,
OutputStreams etc.

A change has also been made to CachingOperationInvokerTests to make
a flakey test more robust. Due to System.currentTimeMillis() being
less precise on Windows than it is on *nix platforms, the test could
fail as it would not sleep for long enough for the TTL period to have
expired.
6 years ago
Andy Wilkinson b18fffaf14 Move tests to JUnit 5 wherever possible 6 years ago
Andy Wilkinson aef92b9295 Merge branch '2.1.x'
Closes gh-17079
6 years ago
Andy Wilkinson 24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
6 years ago
Andy Wilkinson c6c139d980 Merge branch '1.5.x' into 2.0.x 6 years ago
Phillip Webb d306b31ce9 Merge branch '2.1.x' 6 years ago
Phillip Webb ccfbd03482 Merge branch '2.0.x' into 2.1.x 6 years ago
Phillip Webb 5fba43aa31 Merge branch '1.5.x' into 2.0.x 6 years ago
Phillip Webb 988f02d766 Merge branch '2.1.x'
Closes gh-16996
6 years ago
Phillip Webb f380ba63eb Exclude Groovy MetaClass from property meta-data
Update `TypeExcludeFilter` to exclude `groovy.lang.MetaClass`.

Closes gh-16981
6 years ago
Phillip Webb 17aaf26590 Use consistent javadoc style for annotation links
Closes gh-13920
6 years ago
Phillip Webb 1e44aba772 Fix compiler warnings and polish
Fix various compiler warnings and apply a little polish.
6 years ago
Phillip Webb 2dfd916c96 Polish 6 years ago