Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 3d5c3be

Browse files
committed
Add Javadoc for classes used for adding native configurations
Closes gh-1361
1 parent a5fa31f commit 3d5c3be

File tree

5 files changed

+142
-17
lines changed

5 files changed

+142
-17
lines changed

spring-aot/src/main/java/org/springframework/nativex/AotOptions.java

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.nativex;
1818

1919
/**
20-
* Options for Spring Native.
20+
* AOT options for Spring Native.
2121
*
2222
* @author Sebastien Deleuze
2323
* @author Andy Clement
@@ -26,22 +26,8 @@ public class AotOptions {
2626

2727
private String mode = Mode.NATIVE.toString();
2828

29-
/**
30-
* Determine if extra debug should come out related to verification of reflection requests.
31-
* Spring Native will compute configuration but a final stage verification runs before it is
32-
* written out to try and ensure what is requested will not lead to problems when the
33-
* native-image is built. This flag enables debugging of that final stage verification.
34-
*/
3529
private boolean debugVerify;
3630

37-
/**
38-
* Determine whether to check Spring components are suitable for inclusion in a native-image.
39-
* For a concrete example, verification currently checks whether bean factory methods are being
40-
* invoked directly in configuration classes. If they are then that must be enforced by using
41-
* CGLIB proxies. CGLIB proxies are not supported in native-image and so a verification error
42-
* will come out with a message indicating the code should switch to method parameter
43-
* injection (allowing Spring to control bean method invocation).
44-
*/
4531
private boolean verify = true;
4632

4733
private boolean removeYamlSupport;
@@ -52,63 +38,116 @@ public class AotOptions {
5238

5339
private boolean removeSpelSupport;
5440

55-
41+
/**
42+
* Should be either {@code native} or {@code native-agent}
43+
* @see #toMode()
44+
*/
5645
public String getMode() {
5746
return mode;
5847
}
5948

49+
/**
50+
* @see #getMode()
51+
*/
6052
public void setMode(String mode) {
6153
this.mode = mode;
6254
}
6355

56+
/**
57+
* Determine whether to check Spring components are suitable for inclusion in a native-image.
58+
* For a concrete example, verification currently checks whether bean factory methods are being
59+
* invoked directly in configuration classes. If they are then that must be enforced by using
60+
* CGLIB proxies. CGLIB proxies are not supported in native-image and so a verification error
61+
* will come out with a message indicating the code should switch to method parameter
62+
* injection (allowing Spring to control bean method invocation).
63+
*/
6464
public boolean isVerify() {
6565
return verify;
6666
}
6767

68+
/**
69+
* @see #isVerify()
70+
*/
6871
public void setVerify(boolean verify) {
6972
this.verify = verify;
7073
}
7174

75+
/**
76+
* Removes Spring Boot Yaml support to optimize the footprint when set to {@code true}.
77+
*/
7278
public boolean isRemoveYamlSupport() {
7379
return removeYamlSupport;
7480
}
7581

82+
/**
83+
* @see #isRemoveYamlSupport()
84+
*/
7685
public void setRemoveYamlSupport(boolean removeYamlSupport) {
7786
this.removeYamlSupport = removeYamlSupport;
7887
}
7988

89+
/**
90+
* Removes Spring Boot JMX support to optimize the footprint when set to {@code true}.
91+
*/
8092
public boolean isRemoveJmxSupport() {
8193
return removeJmxSupport;
8294
}
8395

96+
/**
97+
* @see #isRemoveJmxSupport()
98+
*/
8499
public void setRemoveJmxSupport(boolean removeJmxSupport) {
85100
this.removeJmxSupport = removeJmxSupport;
86101
}
87102

103+
/**
104+
* Determine if extra debug should come out related to verification of reflection requests.
105+
* Spring Native will compute configuration but a final stage verification runs before it is
106+
* written out to try and ensure what is requested will not lead to problems when the
107+
* native-image is built. This flag enables debugging of that final stage verification.
108+
*/
88109
public boolean isDebugVerify() {
89110
return debugVerify;
90111
}
91112

113+
/**
114+
* @see #isDebugVerify()
115+
*/
92116
public void setDebugVerify(boolean debugVerify) {
93117
this.debugVerify = debugVerify;
94118
}
95119

120+
/**
121+
* Removes Spring XML support (XML converters, codecs and XML application context support) when set to {@code true}.
122+
*/
96123
public boolean isRemoveXmlSupport() {
97124
return removeXmlSupport;
98125
}
99126

127+
/**
128+
* @see #isRemoveXmlSupport()
129+
*/
100130
public void setRemoveXmlSupport(boolean removeXmlSupport) {
101131
this.removeXmlSupport = removeXmlSupport;
102132
}
103133

134+
/**
135+
* Removes Spring SpEL support to optimize the footprint when set to {@code true}.
136+
*/
104137
public boolean isRemoveSpelSupport() {
105138
return removeSpelSupport;
106139
}
107140

141+
/**
142+
* @see #isRemoveSpelSupport()
143+
*/
108144
public void setRemoveSpelSupport(boolean removeSpelSupport) {
109145
this.removeSpelSupport = removeSpelSupport;
110146
}
111147

148+
/**
149+
* Turn {@link #mode} to a {@link Mode}.
150+
*/
112151
public Mode toMode() {
113152
if (this.mode == null || this.mode.equals(Mode.NATIVE.toString())) {
114153
return Mode.NATIVE;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2019-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Support for native.
19+
*/
20+
package org.springframework.nativex;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2019-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Provide configuration for native types.
19+
*/
20+
package org.springframework.nativex.type;

spring-native-docs/pom.xml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
<artifactId>spring-native</artifactId>
2323
<optional>true</optional>
2424
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.experimental</groupId>
27+
<artifactId>spring-aot</artifactId>
28+
<optional>true</optional>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot</artifactId>
33+
<optional>true</optional>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.ow2.asm</groupId>
37+
<artifactId>asm-tree</artifactId>
38+
<optional>true</optional>
39+
</dependency>
2540
</dependencies>
2641
<build>
2742
<plugins>
@@ -168,14 +183,25 @@
168183
<dependencySourceIncludes>
169184
<dependencySourceInclude>${project.groupId}:*</dependencySourceInclude>
170185
</dependencySourceIncludes>
171-
<sourceFileIncludes>org/springframework/nativex/hint/*.java</sourceFileIncludes>
186+
<excludePackageNames>org.springframework.nativex.type.*</excludePackageNames>
187+
<sourceFileIncludes>
188+
<!-- spring-native -->
189+
<sourceFileInclude>org/springframework/nativex/hint/*.java</sourceFileInclude>
190+
191+
<!-- spring-aot -->
192+
<sourceFileInclude>org/springframework/nativex/AotOptions.java</sourceFileInclude>
193+
<sourceFileInclude>org/springframework/nativex/Mode.java</sourceFileInclude>
194+
<sourceFileInclude>org/springframework/nativex/type/NativeConfiguration.java</sourceFileInclude>
195+
<sourceFileInclude>org/springframework/aot/context/bootstrap/generator/infrastructure/nativex/*.java</sourceFileInclude>
196+
</sourceFileIncludes>
172197
<detectJavaApiLink>false</detectJavaApiLink>
173198
<detectOfflineLinks>false</detectOfflineLinks>
174199
<attach>false</attach>
175200
<quiet>true</quiet>
176201
<stylesheetfile>${basedir}/src/main/javadoc/spring-javadoc.css</stylesheetfile>
177202
<links>
178203
<link>https://docs.oracle.com/javase/8/docs/api</link>
204+
<link>https://docs.spring.io/spring-boot/docs/current/api/</link>
179205
</links>
180206
</configuration>
181207
</execution>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2019-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Allow to specify native configuration via annotated hints.
19+
*/
20+
package org.springframework.nativex.hint;

0 commit comments

Comments
 (0)