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

Commit

Permalink
Rename, document hints and use them in the webclient sample
Browse files Browse the repository at this point in the history
 - NativeImageHint -> NativeHint
 - NativeImageConfiguration -> NativeConfiguration
 - webclient sample now deserialize a Pojo and requires a user side
   configuration
 - Documentation has been updated accordingly
 - Javadoc has been fixed and is now generated for spring-native-feature

Closes gh-412
  • Loading branch information
sdeleuze committed Feb 4, 2021
1 parent 093bfc4 commit 5836786
Show file tree
Hide file tree
Showing 141 changed files with 951 additions and 721 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import org.springframework.nativex.extension.InitializationInfo;
import org.springframework.nativex.extension.InitializationTime;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;

@NativeImageHint(
@NativeHint(
initializationInfos = @InitializationInfo(types = {
org.slf4j.spi.LocationAwareLogger.class,
org.slf4j.Logger.class,
Expand Down Expand Up @@ -34,5 +34,5 @@
"org.apache.logging.slf4j",
"org.jboss.logging"
}, initTime = InitializationTime.BUILD))
public class LoggingInitHints implements NativeImageConfiguration {
public class LoggingInitHints implements NativeConfiguration {
}
8 changes: 4 additions & 4 deletions spring-native-configuration/src/main/java/MiscInitHints.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import org.springframework.nativex.extension.InitializationInfo;
import org.springframework.nativex.extension.InitializationTime;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;

@NativeImageHint(
@NativeHint(
initializationInfos = @InitializationInfo(types = {
org.h2.util.Bits.class,
org.hibernate.EntityMode.class,
Expand All @@ -23,5 +23,5 @@
"io.r2dbc.spi",
"javax.transaction"
}, initTime = InitializationTime.BUILD))
public class MiscInitHints implements NativeImageConfiguration {
public class MiscInitHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
import com.mysql.cj.protocol.SocksProxySocketFactory;
import com.mysql.cj.protocol.StandardSocketFactory;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ResourcesInfo;
import org.springframework.nativex.extension.TypeInfo;

@NativeImageHint(trigger= Driver.class, typeInfos= {
@NativeHint(trigger= Driver.class, typeInfos= {
@TypeInfo(types = {
FailoverConnectionUrl.class,
FailoverDnsSrvConnectionUrl.class,
Expand Down Expand Up @@ -100,5 +100,5 @@
@ResourcesInfo(patterns = "com/mysql/cj/TlsSettings.properties"),
@ResourcesInfo(isBundle = true, patterns = "com.mysql.cj.LocalizedErrorMessages")
})
public class MySqlHints implements NativeImageConfiguration {
public class MySqlHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpoint;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;

@NativeImageHint(trigger = WavefrontEndpointAutoConfiguration.class, typeInfos = {
@NativeHint(trigger = WavefrontEndpointAutoConfiguration.class, typeInfos = {
@TypeInfo(types = {
WavefrontController.class
}, typeNames = {
Expand All @@ -19,5 +19,5 @@
ControllerEndpoint.class
}, access = AccessBits.LOAD_AND_CONSTRUCT|AccessBits.DECLARED_METHODS)
})
public class WavefrontEndpointHints implements NativeImageConfiguration {
public class WavefrontEndpointHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
import io.micrometer.core.instrument.push.PushMeterRegistry;
import io.micrometer.core.instrument.push.PushRegistryConfig;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ResourcesInfo;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@NativeImageHint(trigger = WavefrontAutoConfiguration.class, typeInfos = {
@NativeHint(trigger = WavefrontAutoConfiguration.class, typeInfos = {
@TypeInfo(types = {
AbstractFuture.class,
WavefrontJvmReporter.class,
Expand Down Expand Up @@ -94,5 +94,5 @@
}, access = AccessBits.LOAD_AND_CONSTRUCT|AccessBits.DECLARED_METHODS)

}, resourcesInfos = @ResourcesInfo(patterns = "build", isBundle = true))
public class WavefrontHints implements NativeImageConfiguration {
public class WavefrontHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.lettuce;

import org.springframework.nativex.extension.FieldInfo;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ProxyInfo;
import org.springframework.nativex.extension.TypeInfo;

@NativeImageHint(trigger = io.lettuce.core.RedisClient.class,
@NativeHint(trigger = io.lettuce.core.RedisClient.class,
typeInfos = {
@TypeInfo(types = {
io.lettuce.core.AbstractRedisAsyncCommands.class,
Expand Down Expand Up @@ -74,5 +74,5 @@
})
}
)
public class LettuceHints implements NativeImageConfiguration {
public class LettuceHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

import org.springframework.nativex.extension.InitializationInfo;
import org.springframework.nativex.extension.InitializationTime;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;

@NativeImageHint(initializationInfos = {
@NativeHint(initializationInfos = {
@InitializationInfo(initTime=InitializationTime.RUN,
packageNames = "io.netty.channel.epoll",
types = {
Expand All @@ -42,5 +42,5 @@
"io.netty.handler.codec.http.websocketx.extensions.compression.DeflateDecoder"
})
})
public class NettyHints implements NativeImageConfiguration {
public class NettyHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import io.netty.util.internal.shaded.org.jctools.queues.IndexedQueueSizeUtil;

import org.springframework.nativex.extension.FieldInfo;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.TypeInfo;

@NativeImageHint(trigger = IndexedQueueSizeUtil.class, typeInfos = {
@NativeHint(trigger = IndexedQueueSizeUtil.class, typeInfos = {
@TypeInfo(
typeNames = "io.rsocket.internal.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
fields = @FieldInfo(name = "producerLimit", allowUnsafeAccess = true)),
Expand All @@ -18,5 +18,5 @@
typeNames = "io.rsocket.internal.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
fields = @FieldInfo(name = "consumerIndex", allowUnsafeAccess = true)),
})
public class RSocketHints implements NativeImageConfiguration {
public class RSocketHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kotlin;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ResourcesInfo;
import org.springframework.nativex.extension.TypeInfo;

Expand All @@ -10,7 +10,7 @@
import static org.springframework.nativex.type.AccessBits.DECLARED_METHODS;
import static org.springframework.nativex.type.AccessBits.PUBLIC_METHODS;

@NativeImageHint(
@NativeHint(
trigger=kotlin.Unit.class,
resourcesInfos= {
@ResourcesInfo(patterns= {
Expand All @@ -27,5 +27,5 @@
"kotlin.KotlinVersion$Companion[]"
})
})
public class KotlinHints implements NativeImageConfiguration {
public class KotlinHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.springframework.nativex.extension.InitializationInfo;
import org.springframework.nativex.extension.InitializationTime;
import org.springframework.nativex.extension.MethodInfo;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;

@NativeImageHint(trigger= Tomcat.class, typeInfos = {
@NativeHint(trigger= Tomcat.class, typeInfos = {
@TypeInfo(types = TomcatEmbeddedWebappClassLoader.class),
@TypeInfo(types = AbstractProtocol.class, methods = @MethodInfo(name = "getLocalPort"),access=AccessBits.CLASS),
@TypeInfo(types = Http11NioProtocol.class),
Expand All @@ -24,5 +24,5 @@
org.apache.catalina.Globals.class
}, initTime = InitializationTime.BUILD)
}, importInfos = CommonWebInfos.class)
public class TomcatHints implements NativeImageConfiguration {
public class TomcatHints implements NativeConfiguration {
}
8 changes: 4 additions & 4 deletions spring-native-configuration/src/main/java/org/h2/H2Hints.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
import org.h2.store.fs.FilePathSplit;
import org.h2.store.fs.FilePathZip;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;

@NativeImageHint(trigger= Driver.class, typeInfos= {
@NativeHint(trigger= Driver.class, typeInfos= {
@TypeInfo( types = {
FilePathDisk.class, FilePathMem.class, FilePathNioMem.class,
FilePathSplit.class, FilePathNio.class, FilePathNioMapped.class, FilePathAsync.class, FilePathZip.class, FilePathRetryOnInterrupt.class,
Expand All @@ -40,5 +40,5 @@
typeNames= {"org.h2.store.fs.FilePathMemLZF","org.h2.store.fs.FilePathNioMemLZF"},
access=AccessBits.LOAD_AND_CONSTRUCT)}
)
public class H2Hints implements NativeImageConfiguration {
public class H2Hints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.hibernate;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ProxyInfo;
import org.springframework.nativex.extension.TypeInfo;

import static org.springframework.nativex.type.AccessBits.*;

@NativeImageHint(trigger = org.hibernate.Session.class,
@NativeHint(trigger = org.hibernate.Session.class,
proxyInfos = {
@ProxyInfo(types = {
org.hibernate.Session.class,
Expand All @@ -27,5 +27,5 @@
@TypeInfo(types = org.hibernate.query.spi.QueryImplementor.class, access = PUBLIC_METHODS | DECLARED_FIELDS | DECLARED_METHODS | DECLARED_CONSTRUCTORS)
}
)
public class HibernateHints implements NativeImageConfiguration {
public class HibernateHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import org.springframework.nativex.extension.InitializationInfo;
import org.springframework.nativex.extension.InitializationTime;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ProxyInfo;

@NativeImageHint(
@NativeHint(
initializationInfos = @InitializationInfo(types = {
org.hibernate.validator.internal.engine.groups.ValidationOrderGenerator.class,
org.hibernate.validator.internal.engine.ValidatorImpl.class,
Expand Down Expand Up @@ -52,5 +52,5 @@
org.springframework.core.DecoratingProxy.class
})
)
public class ValidatorHints implements NativeImageConfiguration {
public class ValidatorHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

import org.hsqldb.jdbc.JDBCDriver;
import org.hsqldb.lib.FileUtil;
import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;

import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.ResourcesInfo;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;


@NativeImageHint(trigger=JDBCDriver.class, typeInfos = {
@NativeHint(trigger=JDBCDriver.class, typeInfos = {
@TypeInfo( types= {FileUtil.class},
typeNames= {"org.hsqldb.dbinfo.DatabaseInformationFull"})
}, resourcesInfos = {
@ResourcesInfo(patterns = {"org/hsqldb/resources/information-schema.sql", "org/hsqldb/resources/lob-schema.sql", "org/hsqldb/resources/jdklogging-default.properties"}),
@ResourcesInfo(isBundle = true, patterns = "org.hsqldb.resources.sql-state-messages")
})
public class HSQLDBHints implements NativeImageConfiguration {
public class HSQLDBHints implements NativeConfiguration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package org.postgresql;

import org.springframework.nativex.extension.NativeImageConfiguration;
import org.springframework.nativex.extension.NativeImageHint;
import org.springframework.nativex.extension.NativeConfiguration;
import org.springframework.nativex.extension.NativeHint;
import org.springframework.nativex.extension.TypeInfo;
import org.springframework.nativex.type.AccessBits;

@NativeImageHint(trigger = Driver.class, typeInfos= {
@NativeHint(trigger = Driver.class, typeInfos= {
@TypeInfo(types = Driver.class),
@TypeInfo(types = PGProperty.class, access = AccessBits.DECLARED_FIELDS)
})
public class PostgresqlHints implements NativeImageConfiguration {
public class PostgresqlHints implements NativeConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package org.springframework;

import org.springframework.nativex.extension.ComponentProcessor;
import org.springframework.nativex.extension.NativeImageContext;
import org.springframework.nativex.extension.NativeContext;
import org.springframework.nativex.type.Type;

import java.util.ArrayList;
Expand All @@ -31,13 +31,13 @@
public class PrePostSecuredComponentProcessor implements ComponentProcessor {

@Override
public boolean handle(NativeImageContext imageContext, String componentType, List<String> classifiers) {
public boolean handle(NativeContext imageContext, String componentType, List<String> classifiers) {
Type type = imageContext.getTypeSystem().resolveName(componentType);
return (type != null && (type.isAtPrePostSecured()));
}

@Override
public void process(NativeImageContext imageContext, String componentType, List<String> classifiers) {
public void process(NativeContext imageContext, String componentType, List<String> classifiers) {
Type type = imageContext.getTypeSystem().resolveName(componentType);
List<String> prePostSecuredInterfaces = new ArrayList<>();
for (Type intface: type.getInterfaces()) {
Expand Down
Loading

0 comments on commit 5836786

Please sign in to comment.