forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ArC: introduce quarkus.arc.optimize-contexts=auto
- if "auto" is used then only optimize if there is less than 1000 beans in the app; removed beans are excluded - use this as the default value
- Loading branch information
Showing
7 changed files
with
133 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...loyment/src/test/java/io/quarkus/arc/test/context/optimized/OptimizeContextsAutoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkus.arc.test.context.optimized; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.ServiceLoader; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.ComponentsProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OptimizeContextsAutoTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root | ||
.addClasses(SimpleBean.class)) | ||
.overrideConfigKey("quarkus.arc.optimize-contexts", "auto"); | ||
|
||
@Inject | ||
SimpleBean bean; | ||
|
||
@Test | ||
public void testContexts() { | ||
assertTrue(bean.ping()); | ||
for (ComponentsProvider componentsProvider : ServiceLoader.load(ComponentsProvider.class)) { | ||
// We have less than 1000 beans | ||
assertFalse(componentsProvider.getComponents().getContextInstances().isEmpty()); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ent/src/test/java/io/quarkus/arc/test/context/optimized/OptimizeContextsDisabledTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.quarkus.arc.test.context.optimized; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.ServiceLoader; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.ComponentsProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OptimizeContextsDisabledTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root | ||
.addClasses(SimpleBean.class)) | ||
.overrideConfigKey("quarkus.arc.optimize-contexts", "false"); | ||
|
||
@Inject | ||
SimpleBean bean; | ||
|
||
@Test | ||
public void testContexts() { | ||
assertTrue(bean.ping()); | ||
for (ComponentsProvider componentsProvider : ServiceLoader.load(ComponentsProvider.class)) { | ||
assertTrue(componentsProvider.getComponents().getContextInstances().isEmpty()); | ||
} | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...nsions/arc/deployment/src/test/java/io/quarkus/arc/test/context/optimized/SimpleBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.quarkus.arc.test.context.optimized; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
class SimpleBean { | ||
|
||
public boolean ping() { | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters