Skip to content

Commit 5db7ebd

Browse files
author
patrickt
committed
Merged in bugfix/EL-364-serialization-issues-with-non-tri (pull request #184)
EL-364: Added fixes for the serialization and archetyupe. Approved-by: Keith Hudnall
2 parents 71ad0c6 + 2751be3 commit 5db7ebd

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

  • deployment-jetty/src/main/java/dev/getelements/elements/deployment/jetty/loader
  • sdk-element-standard-kt/src/main/resources/archetype-resources/element

deployment-jetty/src/main/java/dev/getelements/elements/deployment/jetty/loader/JakartaRsLoader.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
1414
import org.eclipse.jetty.ee10.servlet.ServletHolder;
1515
import org.eclipse.jetty.server.Handler.Sequence;
16+
import org.glassfish.jersey.server.ServerProperties;
1617
import org.glassfish.jersey.servlet.ServletContainer;
1718
import org.slf4j.Logger;
1819
import org.slf4j.LoggerFactory;
@@ -28,6 +29,7 @@
2829
import static dev.getelements.elements.sdk.model.Constants.APP_OUTSIDE_URL;
2930
import static org.glassfish.jersey.CommonProperties.MOXY_JSON_FEATURE_DISABLE;
3031
import static org.glassfish.jersey.server.ResourceConfig.forApplication;
32+
import static org.glassfish.jersey.server.ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE;
3133

3234
/**
3335
* Searches an {@link Element} for a service of type {@link Application} and loads it into the application container
@@ -109,6 +111,13 @@ private JettyDeploymentRecord deploy(final PendingDeployment pending,
109111
config.property(MOXY_JSON_FEATURE_DISABLE, true);
110112
}
111113

114+
if (!config.hasProperty(FEATURE_AUTO_DISCOVERY_DISABLE)) {
115+
// We know this interferes with Kotlin based elements or any Element which tries to include its own
116+
// jackson provider. So we disable support for this by default. Even in non-kotlin projects this should
117+
// be avoided because we end up polluting the Element's classpath with services it may not want to use.
118+
config.property(FEATURE_AUTO_DISCOVERY_DISABLE, true);
119+
}
120+
112121
final var container = new ServletContainer(config);
113122
final var holder = new ServletHolder(container);
114123

sdk-element-standard-kt/src/main/resources/archetype-resources/element/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@
185185
<prependGroupId>true</prependGroupId>
186186
</configuration>
187187
</execution>
188+
<!-- Kotlin Specific. The API must have the Kotlin libraries included -->
189+
<execution>
190+
<id>elm-copy-kotlin-stdlib-api</id>
191+
<phase>prepare-package</phase>
192+
<goals>
193+
<goal>copy-dependencies</goal>
194+
</goals>
195+
<configuration>
196+
<outputDirectory>${elm.element.dir}/api</outputDirectory>
197+
<includeGroupIds>org.jetbrains.kotlin</includeGroupIds>
198+
<prependGroupId>true</prependGroupId>
199+
</configuration>
200+
</execution>
188201
</executions>
189202
</plugin>
190203

0 commit comments

Comments
 (0)