I try to implement a QuarkusTestResourceLifecycleManager implemenation which injects/looks up a bean in ArC, however the bean is not found.
public class FlywayTestResource implements QuarkusTestResourceLifecycleManager {
@Override
public Map<String, String> start() {
Flyway flyway = Arc.container().instance(Flyway.class).get(); //fails
...
Is it basically possible to get some beans injected or can it not work because at this point quarkus arc is not initialized?
Update:
Looks like ConfigProvider.getConfig() does not include application.properties in its sources

Update2: dirty hack could be copying over application.properties to system properties which is super ugly IMO. Or is there a less cumbersome way to add application.properties to config sources?
public void loadApplicationProperties() {
Properties properties = new Properties();
String path = this.getClass().getClassLoader().getResource("application.properties").getPath();
try (FileInputStream input = new FileInputStream(path)) {
properties.load(input);
for (String key : properties.stringPropertyNames()) {
String value = properties.getProperty(key);
System.setProperty(key, value);
}
System.out.println("Properties copied to environment variables successfully.");
} catch (IOException e) {
}
}
Starting services before the Quarkus application starts so I suppose CDI context is not still active.
This extension written by @radcortez is using plain flyway to achive the result; give it a look.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With