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

Commit 254f976

Browse files
committed
Optimize hints
Remove entries which look like not needed anymore with the new AOT engine after testing related samples. Closes gh-1330
1 parent 13da39b commit 254f976

File tree

14 files changed

+21
-124
lines changed

14 files changed

+21
-124
lines changed

spring-native-configuration/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationHints.java

-31
This file was deleted.

spring-native-configuration/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
} , typeNames = {
3838
"org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean",
3939
"org.springframework.data.jpa.util.JpaMetamodelCacheCleanup"
40-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.RESOURCE})
40+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS })
4141
,
4242
jdkProxies = @JdkProxyHint(typeNames = {
4343
"org.springframework.data.jpa.repository.support.CrudMethodMetadata",

spring-native-configuration/src/main/java/org/springframework/boot/autoconfigure/data/r2dbc/R2dbcRepositoriesHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
RepositoryMetadata.class,
3636
R2dbcDialectProvider.class
3737
}, typeNames = {"org.springframework.data.r2dbc.dialect.DialectResolver.R2dbcDialectProvider.BuiltInDialectProvider"}
38-
, access = { TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS, TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.RESOURCE}
38+
, access = { TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS, TypeAccess.DECLARED_CONSTRUCTORS }
3939
)
4040
})
4141
public class R2dbcRepositoriesHints implements NativeConfiguration {

spring-native-configuration/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityHints.java

-9
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,10 @@
1919
import org.springframework.aot.context.bootstrap.generator.infrastructure.nativex.NativeConfigurationRegistry;
2020
import org.springframework.nativex.AotOptions;
2121
import org.springframework.nativex.hint.TypeAccess;
22-
import org.springframework.nativex.hint.NativeHint;
2322
import org.springframework.nativex.type.NativeConfiguration;
24-
import org.springframework.nativex.hint.TypeHint;
2523
import org.springframework.security.config.annotation.web.configuration.AutowiredWebSecurityConfigurersIgnoreParents;
2624
import org.springframework.util.ClassUtils;
2725

28-
@NativeHint(trigger=SecurityAutoConfiguration.class, types = {
29-
@TypeHint(typeNames = {
30-
"org.springframework.boot.autoconfigure.security.DefaultWebSecurityCondition",
31-
"org.springframework.boot.autoconfigure.security.DefaultWebSecurityCondition$Classes",
32-
"org.springframework.boot.autoconfigure.security.DefaultWebSecurityCondition$Beans",
33-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE})
34-
})
3526
public class SecurityHints implements NativeConfiguration {
3627
@Override
3728
public void computeHints(NativeConfigurationRegistry registry, AotOptions aotOptions) {

spring-native-configuration/src/main/java/org/springframework/cloud/client/FeaturesEndpointHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.springframework.nativex.hint.TypeHint;
2424

2525
@NativeHint(trigger = CommonsClientAutoConfiguration.ActuatorConfiguration.class, types = {
26-
@TypeHint(types = FeaturesEndpoint.class, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
26+
@TypeHint(types = FeaturesEndpoint.class, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS }),
2727
@TypeHint(typeNames = {
2828
"org.springframework.cloud.client.actuator.FeaturesEndpoint$Features",
2929
"org.springframework.cloud.client.actuator.FeaturesEndpoint$Feature"

spring-native-configuration/src/main/java/org/springframework/cloud/task/CloudTaskHints.java

-18
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,6 @@
4949
@TypeHint(types = {
5050
AbstractDataSourceInitializer.class,
5151
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS}),
52-
@TypeHint(types = {
53-
DefaultTaskConfigurer.class,
54-
JobLauncherApplicationRunner.class,
55-
TaskJobLauncherApplicationRunner.class,
56-
DataSourcePoolMetadataProvider.class,
57-
TaskRepositoryInitializer.class,
58-
LockRegistry.class,
59-
TaskBatchExecutionListener.class,
60-
TaskBatchAutoConfiguration.class,
61-
TaskBatchExecutionListenerBeanPostProcessor.class,
62-
TaskBatchEventListenerBeanPostProcessor.class,
63-
JobLaunchCondition.class,
64-
BatchEventAutoConfiguration.class
65-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
66-
@TypeHint(typeNames = { "org.springframework.cloud.task.batch.configuration.JobLaunchCondition$FailOnJobFailureCondition"
67-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
68-
@TypeHint(typeNames = { "org.springframework.cloud.task.batch.configuration.JobLaunchCondition$SpringBatchJobCondition"
69-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
7052
@TypeHint(types= DatabaseMetaData.class)},
7153
jdkProxies = {
7254
@JdkProxyHint(typeNames = {

spring-native-configuration/src/main/java/org/springframework/data/SpringDataCommonsHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
@TypeHint(types = Throwable.class, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_FIELDS}),
5757
@TypeHint(typeNames = {
5858
"org.springframework.data.projection.SpelEvaluatingMethodInterceptor$TargetWrapper",
59-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE})
59+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS })
6060
},
6161
jdkProxies = @JdkProxyHint(typeNames = {
6262
"org.springframework.data.annotation.QueryAnnotation",

spring-native-configuration/src/main/java/org/springframework/data/web/config/DataRestHints.java

+7-24
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,17 @@
4747

4848
@NativeHint(trigger = RepositoryRestMvcAutoConfiguration.class, types = {
4949
@TypeHint(types = {
50-
51-
Flux.class,
52-
org.reactivestreams.Publisher.class,
53-
HalMediaTypeConfiguration.class,
54-
5550
org.springframework.data.repository.core.support.RepositoryFactoryInformation.class,
5651
org.springframework.data.repository.support.Repositories.class,
5752
org.springframework.data.repository.support.RepositoryInvoker.class,
5853
org.springframework.data.repository.support.RepositoryInvokerFactory.class,
59-
},
60-
typeNames = {
61-
62-
"org.springframework.data.rest.core.annotation.Description",
63-
"org.springframework.data.rest.core.config.EnumTranslationConfiguration",
64-
"org.springframework.data.rest.core.config.RepositoryRestConfiguration",
65-
66-
"org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration",
67-
"org.springframework.data.rest.webmvc.RepositoryRestController",
68-
"org.springframework.data.rest.webmvc.BasePathAwareController",
69-
70-
"org.springframework.data.rest.webmvc.config.WebMvcRepositoryRestConfiguration",
71-
72-
// EvoInflector
73-
"org.atteo.evo.inflector.English"
74-
},
75-
76-
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}
77-
54+
}, typeNames = {
55+
"org.springframework.data.rest.core.annotation.Description",
56+
"org.springframework.data.rest.webmvc.RepositoryRestController",
57+
"org.springframework.data.rest.webmvc.BasePathAwareController",
58+
// EvoInflector
59+
"org.atteo.evo.inflector.English"
60+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}
7861
),
7962
},
8063
jdkProxies = {

spring-native-configuration/src/main/java/org/springframework/hateoas/config/HateoasHints.java

+3-10
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
@NativeHint(trigger = HalConfiguration.class,
6666
types = {
6767
@TypeHint(types = {
68-
org.springframework.stereotype.Controller.class,
6968
HypermediaType.class,
7069
ExposesResourceFor.class,
7170
RepresentationModelAssembler.class,
@@ -74,18 +73,12 @@
7473
LastInvocationAware.class,
7574
Relation.class,
7675
UriComponentsContributor.class,
77-
78-
HypermediaConfigurationImportSelector.class,
79-
HateoasConfiguration.class,
80-
HypermediaHttpMessageConverterConfiguration.class,
81-
8276
Affordance.class,
8377
AffordanceModel.class,
84-
RestTemplateHateoasConfiguration.class,
85-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
78+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}),
8679
@TypeHint(typeNames = {
8780
"org.atteo.evo.inflector.English",
88-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
81+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}),
8982
@TypeHint(
9083
types = CollectionModel.class,
9184
fields = @FieldHint(name = "content", allowUnsafeAccess = true, allowWrite = true)
@@ -180,7 +173,7 @@ private List<HintDeclaration> computeAtConfigurationClasses(TypeSystem typeSyste
180173
.skipAnnotationInspection()
181174
.skipMethodInspection()
182175
.skipFieldInspection()
183-
.onTypeDiscovered((type, context) -> context.addReflectiveAccess(type, new AccessDescriptor(AccessBits.ALL)))
176+
.onTypeDiscovered((type, context) -> context.addReflectiveAccess(type, new AccessDescriptor(AccessBits.FULL_REFLECTION)))
184177
.use(typeSystem)
185178
.toProcessTypesMatching(type -> type.isPartOfDomain("org.springframework.hateoas") && type.isAtConfiguration());
186179
}

spring-native-configuration/src/main/java/org/springframework/kafka/annotation/KafkaHints.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@
122122
KafkaListener.class,
123123
org.springframework.messaging.handler.annotation.MessageMapping.class,
124124
KafkaListeners.class,
125-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}),
125+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}),
126126
@TypeHint(types= {
127127
KafkaListenerAnnotationBeanPostProcessor.class,
128128
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.DECLARED_FIELDS}),
129129
@TypeHint(types= {
130130
KafkaBootstrapConfiguration.class,
131131
CreatableTopic.class,
132132
KafkaListenerEndpointRegistry.class
133-
}, access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.RESOURCE}),
133+
}, access = { TypeAccess.DECLARED_CONSTRUCTORS}),
134134
@TypeHint(types = {
135135
NewTopic.class,
136136
AbstractKafkaListenerContainerFactory.class,

spring-native-configuration/src/main/java/org/springframework/plugin/PluginHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
org.springframework.plugin.core.support.AbstractTypeAwareSupport.class,
3232
org.springframework.plugin.core.support.PluginRegistryFactoryBean.class,
3333
},
34-
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE})
34+
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS })
3535
public class PluginHints {
3636

3737
}

spring-native-configuration/src/main/java/org/springframework/scheduling/quartz/QuartzHints.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
*
4848
* @author Josh Long
4949
*/
50-
51-
5250
@NativeHint(trigger = Job.class,
5351
types = @TypeHint(
5452
types = CopyOnWriteArrayList.class,
@@ -59,7 +57,7 @@
5957
name = "lock"
6058
)
6159
},
62-
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}
60+
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}
6361
),
6462
serializables = @SerializationHint(
6563
types = {
@@ -86,15 +84,15 @@
8684
allowUnsafeAccess = true, name = "loadFactor"
8785
)
8886
},
89-
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE}
87+
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS}
9088
)
9189
)
9290
@NativeHint(
9391
trigger = org.quartz.utils.DirtyFlagMap.class,
9492
types = {
9593
@TypeHint(types = java.util.HashMap.class),
9694
@TypeHint(
97-
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS, TypeAccess.RESOURCE},
95+
access = { TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS, TypeAccess.PUBLIC_METHODS},
9896
types = {
9997
org.quartz.impl.triggers.SimpleTriggerImpl.class,
10098
org.quartz.utils.DirtyFlagMap.class,

spring-native-configuration/src/main/java/org/springframework/web/socket/WebSocketHints.java

+1-19
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,7 @@
4040
import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy;
4141
import org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService;
4242

43-
@NativeHint(trigger = DelegatingWebSocketMessageBrokerConfiguration.class, types = {
44-
@TypeHint(types= {
45-
WebSocketHandlerRegistry.class,
46-
AbstractSubscribableChannel.class,
47-
SimpMessagingTemplate.class,
48-
WebSocketHandler.class,
49-
WebSocketTransportRegistration.class,
50-
AbstractBrokerMessageHandler.class,
51-
TaskExecutor.class,
52-
ChannelRegistration.class,
53-
MessageBrokerRegistry.class,
54-
CompositeMessageConverter.class,
55-
UserDestinationResolver.class,
56-
UserDestinationMessageHandler.class,
57-
MessageHandler.class,
58-
SimpUserRegistry.class
59-
}, access = TypeAccess.RESOURCE), // TODO Suspicious entry, try to remove it
60-
@TypeHint(types = TomcatRequestUpgradeStrategy.class)
61-
})
43+
6244
@NativeHint(trigger = DelegatingWebSocketConfiguration.class, types = {
6345
@TypeHint(types = TomcatRequestUpgradeStrategy.class)
6446
})

spring-native-configuration/src/main/resources/META-INF/spring.factories

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguratio
4444
org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpointAutoConfigurationHints,\
4545
org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfigurationHints,\
4646
org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusEndpointAutoConfigurationHints,\
47-
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfigurationHints,\
4847
org.springframework.boot.actuate.autoconfigure.startup.StartupEndpointAutoConfigurationHints,\
4948
org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfigurationHints,\
5049
org.springframework.boot.autoconfigure.aop.AopHints,\

0 commit comments

Comments
 (0)