Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
34089374
Commit
34089374
authored
Mar 25, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4.x'
Closes gh-25799
parents
759e5cb5
af7e4e21
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
261 additions
and
44 deletions
+261
-44
ConfigurationMetadataAnnotationProcessor.java
...onprocessor/ConfigurationMetadataAnnotationProcessor.java
+27
-7
MetadataGenerationEnvironment.java
...configurationprocessor/MetadataGenerationEnvironment.java
+9
-6
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+8
-3
IncrementalBuildMetadataGenerationTests.java
...ionprocessor/IncrementalBuildMetadataGenerationTests.java
+2
-3
MetadataGenerationEnvironmentFactory.java
...rationprocessor/MetadataGenerationEnvironmentFactory.java
+11
-3
TestConfigurationMetadataAnnotationProcessor.java
...or/test/TestConfigurationMetadataAnnotationProcessor.java
+25
-4
ControllerEndpoint.java
...ramework/boot/configurationsample/ControllerEndpoint.java
+40
-0
JmxEndpoint.java
...springframework/boot/configurationsample/JmxEndpoint.java
+9
-8
RestControllerEndpoint.java
...work/boot/configurationsample/RestControllerEndpoint.java
+40
-0
ServletEndpoint.java
...ngframework/boot/configurationsample/ServletEndpoint.java
+40
-0
WebEndpoint.java
...springframework/boot/configurationsample/WebEndpoint.java
+40
-0
SpecificEndpoint.java
...k/boot/configurationsample/endpoint/SpecificEndpoint.java
+5
-5
IncrementalSpecificEndpoint.java
...ple/endpoint/incremental/IncrementalSpecificEndpoint.java
+5
-5
No files found.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -20,7 +20,9 @@ import java.io.FileNotFoundException;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.time.Duration
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -58,7 +60,12 @@ import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
* @since 1.2.0
*/
@SupportedAnnotationTypes
({
ConfigurationMetadataAnnotationProcessor
.
CONFIGURATION_PROPERTIES_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
CONTROLLER_ENDPOINT_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
ENDPOINT_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
JMX_ENDPOINT_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
REST_CONTROLLER_ENDPOINT_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
SERVLET_ENDPOINT_ANNOTATION
,
ConfigurationMetadataAnnotationProcessor
.
WEB_ENDPOINT_ANNOTATION
,
"org.springframework.context.annotation.Configuration"
})
public
class
ConfigurationMetadataAnnotationProcessor
extends
AbstractProcessor
{
...
...
@@ -74,8 +81,18 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
static
final
String
DEFAULT_VALUE_ANNOTATION
=
"org.springframework.boot.context.properties.bind.DefaultValue"
;
static
final
String
CONTROLLER_ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint"
;
static
final
String
ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.annotation.Endpoint"
;
static
final
String
JMX_ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpoint"
;
static
final
String
REST_CONTROLLER_ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint"
;
static
final
String
SERVLET_ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint"
;
static
final
String
WEB_ENDPOINT_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.web.annotation.WebEndpoint"
;
static
final
String
READ_OPERATION_ANNOTATION
=
"org.springframework.boot.actuate.endpoint.annotation.ReadOperation"
;
static
final
String
NAME_ANNOTATION
=
"org.springframework.boot.context.properties.bind.Name"
;
...
...
@@ -109,8 +126,9 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
return
DEFAULT_VALUE_ANNOTATION
;
}
protected
String
endpointAnnotation
()
{
return
ENDPOINT_ANNOTATION
;
protected
Set
<
String
>
endpointAnnotations
()
{
return
new
HashSet
<>(
Arrays
.
asList
(
CONTROLLER_ENDPOINT_ANNOTATION
,
ENDPOINT_ANNOTATION
,
JMX_ENDPOINT_ANNOTATION
,
REST_CONTROLLER_ENDPOINT_ANNOTATION
,
SERVLET_ENDPOINT_ANNOTATION
,
WEB_ENDPOINT_ANNOTATION
));
}
protected
String
readOperationAnnotation
()
{
...
...
@@ -138,7 +156,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
this
.
metadataCollector
=
new
MetadataCollector
(
env
,
this
.
metadataStore
.
readMetadata
());
this
.
metadataEnv
=
new
MetadataGenerationEnvironment
(
env
,
configurationPropertiesAnnotation
(),
nestedConfigurationPropertyAnnotation
(),
deprecatedConfigurationPropertyAnnotation
(),
constructorBindingAnnotation
(),
defaultValueAnnotation
(),
endpointAnnotation
(),
constructorBindingAnnotation
(),
defaultValueAnnotation
(),
endpointAnnotation
s
(),
readOperationAnnotation
(),
nameAnnotation
());
}
...
...
@@ -151,9 +169,11 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
processElement
(
element
);
}
}
TypeElement
endpointType
=
this
.
metadataEnv
.
getEndpointAnnotationElement
();
if
(
endpointType
!=
null
)
{
// Is @Endpoint available
getElementsAnnotatedOrMetaAnnotatedWith
(
roundEnv
,
endpointType
).
forEach
(
this
::
processEndpoint
);
Set
<
TypeElement
>
endpointTypes
=
this
.
metadataEnv
.
getEndpointAnnotationElements
();
if
(!
endpointTypes
.
isEmpty
())
{
// Are endpoint annotations available
for
(
TypeElement
endpointType
:
endpointTypes
)
{
getElementsAnnotatedOrMetaAnnotatedWith
(
roundEnv
,
endpointType
).
forEach
(
this
::
processEndpoint
);
}
}
if
(
roundEnv
.
processingOver
())
{
try
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -24,7 +24,9 @@ import java.util.LinkedHashMap;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
javax.annotation.processing.Messager
;
import
javax.annotation.processing.ProcessingEnvironment
;
...
...
@@ -91,7 +93,7 @@ class MetadataGenerationEnvironment {
private
final
String
defaultValueAnnotation
;
private
final
S
tring
endpointAnnotation
;
private
final
S
et
<
String
>
endpointAnnotations
;
private
final
String
readOperationAnnotation
;
...
...
@@ -99,7 +101,7 @@ class MetadataGenerationEnvironment {
MetadataGenerationEnvironment
(
ProcessingEnvironment
environment
,
String
configurationPropertiesAnnotation
,
String
nestedConfigurationPropertyAnnotation
,
String
deprecatedConfigurationPropertyAnnotation
,
String
constructorBindingAnnotation
,
String
defaultValueAnnotation
,
S
tring
endpointAnnotation
,
String
constructorBindingAnnotation
,
String
defaultValueAnnotation
,
S
et
<
String
>
endpointAnnotations
,
String
readOperationAnnotation
,
String
nameAnnotation
)
{
this
.
typeUtils
=
new
TypeUtils
(
environment
);
this
.
elements
=
environment
.
getElementUtils
();
...
...
@@ -110,7 +112,7 @@ class MetadataGenerationEnvironment {
this
.
deprecatedConfigurationPropertyAnnotation
=
deprecatedConfigurationPropertyAnnotation
;
this
.
constructorBindingAnnotation
=
constructorBindingAnnotation
;
this
.
defaultValueAnnotation
=
defaultValueAnnotation
;
this
.
endpointAnnotation
=
endpointAnnotation
;
this
.
endpointAnnotation
s
=
endpointAnnotations
;
this
.
readOperationAnnotation
=
readOperationAnnotation
;
this
.
nameAnnotation
=
nameAnnotation
;
}
...
...
@@ -270,8 +272,9 @@ class MetadataGenerationEnvironment {
return
getAnnotation
(
element
,
this
.
defaultValueAnnotation
);
}
TypeElement
getEndpointAnnotationElement
()
{
return
this
.
elements
.
getTypeElement
(
this
.
endpointAnnotation
);
Set
<
TypeElement
>
getEndpointAnnotationElements
()
{
return
this
.
endpointAnnotations
.
stream
().
map
(
this
.
elements
::
getTypeElement
).
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toSet
());
}
AnnotationMirror
getReadOperationAnnotation
(
Element
element
)
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -74,13 +74,18 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
assertThat
(
new
ConfigurationMetadataAnnotationProcessor
().
getSupportedAnnotationTypes
())
.
containsExactlyInAnyOrder
(
"org.springframework.boot.context.properties.ConfigurationProperties"
,
"org.springframework.context.annotation.Configuration"
,
"org.springframework.boot.actuate.endpoint.annotation.Endpoint"
);
"org.springframework.boot.actuate.endpoint.annotation.Endpoint"
,
"org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpoint"
,
"org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint"
,
"org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint"
,
"org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint"
,
"org.springframework.boot.actuate.endpoint.web.annotation.WebEndpoint"
);
}
@Test
void
notAnnotated
()
{
ConfigurationMetadata
metadata
=
compile
(
NotAnnotated
.
class
);
assertThat
(
metadata
.
getItems
()).
isEmpty
();
assertThat
(
metadata
).
isNull
();
}
@Test
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/IncrementalBuildMetadataGenerationTests.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -69,8 +69,7 @@ class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGeneration
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"bar.counter"
).
withDefaultValue
(
0
));
project
.
replaceText
(
BarProperties
.
class
,
"@ConfigurationProperties"
,
"//@ConfigurationProperties"
);
metadata
=
project
.
incrementalBuild
(
BarProperties
.
class
);
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"foo.counter"
).
withDefaultValue
(
0
));
assertThat
(
metadata
).
isNotEqualTo
(
Metadata
.
withProperty
(
"bar.counter"
));
assertThat
(
metadata
).
isNull
();
}
@Test
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironmentFactory.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -16,6 +16,9 @@
package
org
.
springframework
.
boot
.
configurationprocessor
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.function.Function
;
import
javax.annotation.processing.ProcessingEnvironment
;
...
...
@@ -31,13 +34,18 @@ class MetadataGenerationEnvironmentFactory implements Function<ProcessingEnviron
@Override
public
MetadataGenerationEnvironment
apply
(
ProcessingEnvironment
environment
)
{
Set
<
String
>
endpointAnnotations
=
new
HashSet
<>(
Arrays
.
asList
(
TestConfigurationMetadataAnnotationProcessor
.
CONTROLLER_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
REST_CONTROLLER_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
SERVLET_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
WEB_ENDPOINT_ANNOTATION
));
return
new
MetadataGenerationEnvironment
(
environment
,
TestConfigurationMetadataAnnotationProcessor
.
CONFIGURATION_PROPERTIES_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
NESTED_CONFIGURATION_PROPERTY_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
DEPRECATED_CONFIGURATION_PROPERTY_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
CONSTRUCTOR_BINDING_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
DEFAULT_VALUE_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
DEFAULT_VALUE_ANNOTATION
,
endpointAnnotations
,
TestConfigurationMetadataAnnotationProcessor
.
READ_OPERATION_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
NAME_ANNOTATION
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/test/TestConfigurationMetadataAnnotationProcessor.java
View file @
34089374
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
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.
...
...
@@ -20,6 +20,9 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.annotation.processing.SupportedAnnotationTypes
;
import
javax.annotation.processing.SupportedSourceVersion
;
...
...
@@ -37,7 +40,14 @@ import org.springframework.boot.configurationprocessor.metadata.JsonMarshaller;
* @author Andy Wilkinson
* @author Kris De Volder
*/
@SupportedAnnotationTypes
({
"*"
})
@SupportedAnnotationTypes
({
TestConfigurationMetadataAnnotationProcessor
.
CONFIGURATION_PROPERTIES_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
CONTROLLER_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
JMX_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
REST_CONTROLLER_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
SERVLET_ENDPOINT_ANNOTATION
,
TestConfigurationMetadataAnnotationProcessor
.
WEB_ENDPOINT_ANNOTATION
,
"org.springframework.context.annotation.Configuration"
})
@SupportedSourceVersion
(
SourceVersion
.
RELEASE_6
)
public
class
TestConfigurationMetadataAnnotationProcessor
extends
ConfigurationMetadataAnnotationProcessor
{
...
...
@@ -51,8 +61,18 @@ public class TestConfigurationMetadataAnnotationProcessor extends ConfigurationM
public
static
final
String
DEFAULT_VALUE_ANNOTATION
=
"org.springframework.boot.configurationsample.DefaultValue"
;
public
static
final
String
CONTROLLER_ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.ControllerEndpoint"
;
public
static
final
String
ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.Endpoint"
;
public
static
final
String
JMX_ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.JmxEndpoint"
;
public
static
final
String
REST_CONTROLLER_ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.RestControllerEndpoint"
;
public
static
final
String
SERVLET_ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.ServletEndpoint"
;
public
static
final
String
WEB_ENDPOINT_ANNOTATION
=
"org.springframework.boot.configurationsample.WebEndpoint"
;
public
static
final
String
READ_OPERATION_ANNOTATION
=
"org.springframework.boot.configurationsample.ReadOperation"
;
public
static
final
String
NAME_ANNOTATION
=
"org.springframework.boot.configurationsample.Name"
;
...
...
@@ -91,8 +111,9 @@ public class TestConfigurationMetadataAnnotationProcessor extends ConfigurationM
}
@Override
protected
String
endpointAnnotation
()
{
return
ENDPOINT_ANNOTATION
;
protected
Set
<
String
>
endpointAnnotations
()
{
return
new
HashSet
<>(
Arrays
.
asList
(
CONTROLLER_ENDPOINT_ANNOTATION
,
ENDPOINT_ANNOTATION
,
JMX_ENDPOINT_ANNOTATION
,
REST_CONTROLLER_ENDPOINT_ANNOTATION
,
SERVLET_ENDPOINT_ANNOTATION
,
WEB_ENDPOINT_ANNOTATION
));
}
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/ControllerEndpoint.java
0 → 100644
View file @
34089374
/*
* Copyright 2012-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
.
boot
.
configurationsample
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Alternative to Spring Boot's {@code @ControllerEndpoint} for testing (removes the need
* for a dependency on the real annotation).
*
* @author Andy Wilkinson
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
ControllerEndpoint
{
String
id
()
default
""
;
boolean
enableByDefault
()
default
true
;
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/
Meta
Endpoint.java
→
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/
Jmx
Endpoint.java
View file @
34089374
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
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.
...
...
@@ -22,18 +22,19 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
org.springframework.core.annotation.AliasFor
;
/**
* Alternative to Spring Boot's {@code @JmxEndpoint} for testing (removes the need for a
* dependency on the real annotation).
*
* @author Andy Wilkinson
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Endpoint
public
@interface
MetaEndpoint
{
public
@interface
JmxEndpoint
{
@AliasFor
(
annotation
=
Endpoint
.
class
)
String
id
();
String
id
()
default
""
;
@AliasFor
(
annotation
=
Endpoint
.
class
)
boolean
enableByDefault
()
default
true
;
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/RestControllerEndpoint.java
0 → 100644
View file @
34089374
/*
* Copyright 2012-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
.
boot
.
configurationsample
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Alternative to Spring Boot's {@code @RestControllerEndpoint} for testing (removes the
* need for a dependency on the real annotation).
*
* @author Andy Wilkinson
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
RestControllerEndpoint
{
String
id
()
default
""
;
boolean
enableByDefault
()
default
true
;
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/ServletEndpoint.java
0 → 100644
View file @
34089374
/*
* Copyright 2012-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
.
boot
.
configurationsample
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Alternative to Spring Boot's {@code @ServletEndpoint} for testing (removes the need for
* a dependency on the real annotation).
*
* @author Andy Wilkinson
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
ServletEndpoint
{
String
id
()
default
""
;
boolean
enableByDefault
()
default
true
;
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/WebEndpoint.java
0 → 100644
View file @
34089374
/*
* Copyright 2012-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
.
boot
.
configurationsample
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Alternative to Spring Boot's {@code @WebEndpoint} for testing (removes the need for a
* dependency on the real annotation).
*
* @author Andy Wilkinson
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
WebEndpoint
{
String
id
()
default
""
;
boolean
enableByDefault
()
default
true
;
}
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/endpoint/SpecificEndpoint.java
View file @
34089374
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
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.
...
...
@@ -16,17 +16,17 @@
package
org
.
springframework
.
boot
.
configurationsample
.
endpoint
;
import
org.springframework.boot.configurationsample.MetaEndpoint
;
import
org.springframework.boot.configurationsample.ReadOperation
;
import
org.springframework.boot.configurationsample.WebEndpoint
;
import
org.springframework.lang.Nullable
;
/**
* A meta-annotated endpoint
similar to {@code @WebEndpoint} or {@code @JmxEndpoint} i
n
*
Spring Boot. Also with a package private read operation that has an
optional argument.
* A meta-annotated endpoint
. Also with a package private read operation that has a
n
* optional argument.
*
* @author Stephane Nicoll
*/
@
Meta
Endpoint
(
id
=
"specific"
,
enableByDefault
=
true
)
@
Web
Endpoint
(
id
=
"specific"
,
enableByDefault
=
true
)
public
class
SpecificEndpoint
{
@ReadOperation
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/endpoint/incremental/IncrementalSpecificEndpoint.java
View file @
34089374
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
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.
...
...
@@ -16,15 +16,15 @@
package
org
.
springframework
.
boot
.
configurationsample
.
endpoint
.
incremental
;
import
org.springframework.boot.configurationsample.
Meta
Endpoint
;
import
org.springframework.boot.configurationsample.
Jmx
Endpoint
;
/**
* A meta-annotated endpoint similar to {@code @WebEndpoint} or {@code @JmxEndpoint} in
* Spring Boot.
* A meta-annotated endpoint.
*
* @author Stephane Nicoll
* @author Andy Wilkinson
*/
@
Meta
Endpoint
(
id
=
"incremental"
)
@
Jmx
Endpoint
(
id
=
"incremental"
)
public
class
IncrementalSpecificEndpoint
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment