Commit Graph

209 Commits

Author SHA1 Message Date
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
2021-03-25 15:23:09 +00:00
Stephane Nicoll 946be4eab6 Merge branch '2.3.x'
Closes gh-24059
2020-11-05 16:33:28 +01:00
Stephane Nicoll 4a8646bd09 Merge branch '2.2.x' into 2.3.x
Closes gh-24058
2020-11-05 16:32:52 +01:00
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
2020-11-05 16:01:28 +01:00
izeye 9c35cd41ad Polish
See gh-23986
2020-11-01 17:07:50 +01:00
Phillip Webb a41ff4dfab Merge branch '2.3.x' 2020-10-29 09:07:57 -07:00
Phillip Webb b0c2687aa9 Update copyright year of changed files 2020-10-29 09:07:42 -07:00
Andy Wilkinson 5642dc6d13 Merge branch '2.3.x'
Closes gh-23970
2020-10-29 15:31:59 +00:00
Andy Wilkinson 70d9602b3f Merge branch '2.2.x' into 2.3.x
Closes gh-23969
2020-10-29 15:31:12 +00:00
Andy Wilkinson e7eb7739dc Use overriding rather than overridden getter methods in config prop AP
Fixes gh-23966
2020-10-29 15:30:46 +00:00
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
2020-10-28 21:59:06 -07:00
Phillip Webb 23e5fd798c Merge branch '2.3.x'
Closes gh-23960
2020-10-28 21:18:42 -07:00
Phillip Webb b86dcbec72 Merge branch '2.2.x' into 2.3.x
Closes gh-23959
2020-10-28 21:18:17 -07:00
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
2020-10-28 21:13:08 -07:00
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
2020-10-07 10:53:01 +02:00
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
2020-10-06 16:13:19 +01:00
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
2020-10-06 14:54:24 +01:00
Stephane Nicoll 5feaf2bc1a Polish "Polish empty string checks"
See gh-23550
2020-10-05 10:42:19 +02:00
Santhoshkumar. P 5cb07e292d Polish empty string checks
See gh-23550
2020-10-05 10:38:47 +02:00
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
2020-09-15 11:36:00 -07:00
Phillip Webb c857a743a0 Rename @ImportConfigurationPropertiesBean
Rename `@ImportConfigurationPropertiesBean` to
`@ConfigurationPropertiesImport`.

Closes gh-23172
2020-09-14 19:35:10 -07:00
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
2020-09-09 22:05:49 -07:00
Andy Wilkinson 56ded38f5d Generate default values from Duration and Period .ZERO
Closes gh-23082
2020-08-25 15:46:50 +01:00
Stephane Nicoll dac63fc3e5 Polish 2020-08-06 17:35:01 +02:00
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
2020-07-23 05:36:44 -07:00
Andy Wilkinson 62aa8ce107 Support incremental annotation processing with Gradle
Closes gh-22150
2020-06-30 11:27:32 +01:00
Phillip Webb 9843888714 Merge branch '2.2.x' into 2.3.x
Closes gh-22059
2020-06-22 12:14:35 -07:00
Phillip Webb 3b3a49db1f Polish 'Fix infinite loop in FieldValues'
See gh-22040
2020-06-22 12:01:04 -07:00
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
2020-06-22 11:58:22 -07:00
Phillip Webb 0a05b4c9fd Update copyright year of changed files 2020-06-05 15:36:09 -07:00
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
2020-05-06 00:21:50 -07:00
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
2020-05-05 22:31:49 -07:00
Phillip Webb ad1248e4ec Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder"

Closes gh-21218
2020-04-28 19:20:24 -07:00
Phillip Webb bf41da5322 Update copyright year of changed files 2020-04-21 18:12:27 -07:00
Stephane Nicoll 692885f71e Merge branch '2.2.x'
Closes gh-21049
2020-04-21 16:00:41 +02:00
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
2020-04-21 15:59:34 +02:00
Phillip Webb 3ca896e63f Polish 2020-04-07 12:10:49 -07:00
dreis2211 9588188800 Use isEmpty() where possible
See gh-20370
2020-03-03 18:33:26 -05:00
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
2020-01-23 10:47:53 +01:00
Andy Wilkinson ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
2020-01-10 14:15:35 +00:00
Stephane Nicoll 2c1e81adf0 Polish 2019-12-26 10:42:40 +01:00
Stephane Nicoll b3643965f0 Polish "Detect config props using builder pattern and generics"
See gh-19099
2019-12-23 14:57:48 +01:00
如梦技术 743f4a4cb1 Detect config props using builder pattern and generics
See gh-19099
2019-12-23 14:54:00 +01:00
Phillip Webb 26ff18f37d Merge branch '2.1.x' into 2.2.x 2019-12-13 11:29:51 -08:00
Phillip Webb accd830dd5 Update copyright header of changed files 2019-12-13 11:23:24 -08:00
Andy Wilkinson f1af8c5510 Merge branch '2.1.x'
Closes gh-18889
2019-11-05 15:50:51 +00:00
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
2019-11-05 15:35:11 +00:00
Johnny Lim 45d85778b8 Polish
See gh-18838
2019-11-01 09:01:24 +02:00
Stephane Nicoll d6d32ec01d Polish 2019-10-29 09:02:25 +01:00
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
2019-10-02 17:17:44 -07:00