Repository: quarkusio/quarkus
Issue: quarkus-neo4j requires docker even if devservices are disabled

### Describe the bug

quarkus-neo4j requires docker even if devservices are disabled

```
mvn quarkus:dev -Dquarkus.devservices.enabled=false
...
2021-12-13 21:07:55,423 INFO  [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-0) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375
2021-12-13 21:07:55,508 INFO  [org.tes.doc.DockerMachineClientProviderStrategy] (main) docker-machine executable was not found on PATH ([/Users/rsvoboda/.jbang/bin, /Users/rsvoboda/.sdkman/candidates/mvnd/current/bin, /Users/rsvoboda/.sdkman/candidates/maven/current/bin, /Users/rsvoboda/.sdkman/candidates/jbang/current/bin, /Users/rsvoboda/.sdkman/candidates/java/current/bin, /Users/rsvoboda/bin, /Users/rsvoboda/go/bin, /usr/local/opt/llvm/bin, /Applications/Visual Studio Code.app/Contents/Resources/app/bin, /usr/local/bin, /usr/bin, /bin, /usr/sbin, /sbin, /usr/local/munki, /Library/Apple/usr/bin])

2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main)     UnixSocketClientProviderStrategy: failed with exception TimeoutException (Timeout waiting for result with exception). Root cause LastErrorException ([61] Connection refused)
2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main) As no valid configuration was found, execution cannot continue
...
```

### Expected behavior

quarkus-neo4j DOES NOT requires docker when devservices are disabled

### Actual behavior

quarkus-neo4j requires docker even if devservices are disabled

### How to Reproduce?

 - Generate application with quarkus-neo4j
   - e.g. https://code.quarkus.io/api/download?s=pDS
 - Make sure Docker or Podman is not available/running
 - Run `mvn quarkus:dev -Dquarkus.devservices.enabled=false`

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

Java 17

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.5.2.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.1

### Additional information

_No response_

Changed files:
extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java

diff --git a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
index 946b5ce0eec..7abda98f407 100644
--- a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
+++ b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
@@ -6,12 +6,12 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
-import java.util.function.BooleanSupplier;
 
 import org.jboss.logging.Logger;
 import org.testcontainers.containers.Neo4jContainer;
 import org.testcontainers.utility.DockerImageName;
 
+import io.quarkus.deployment.IsDockerWorking;
 import io.quarkus.deployment.IsNormal;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
@@ -36,18 +36,9 @@ class Neo4jDevServicesProcessor {
     static volatile Neo4jDevServiceConfig runningConfiguration;
     static volatile boolean first = true;
 
-    static final class IsDockerWorking implements BooleanSupplier {
+    private final IsDockerWorking isDockerWorking = new IsDockerWorking(true);
 
-        private final io.quarkus.deployment.IsDockerWorking delegate = new io.quarkus.deployment.IsDockerWorking(true);
-
-        @Override
-        public boolean getAsBoolean() {
-
-            return delegate.getAsBoolean();
-        }
-    }
-
-    @BuildStep(onlyIfNot = IsNormal.class, onlyIf = { IsDockerWorking.class, GlobalDevServicesConfig.Enabled.class })
+    @BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
     public Neo4jDevServiceBuildItem startNeo4jDevService(
             LaunchModeBuildItem launchMode,
             Neo4jBuildTimeConfig neo4jBuildTimeConfig,
@@ -109,6 +100,11 @@ public Neo4jDevServiceBuildItem startNeo4jDevService(
 
     private Neo4jContainer<?> startNeo4j(Neo4jDevServiceConfig configuration, Optional<Duration> timeout) {
 
+        if (!isDockerWorking.getAsBoolean()) {
+            log.debug("Not starting Dev Services for Neo4j, as Docker is not working.");
+            return null;
+        }
+
         if (!configuration.devServicesEnabled) {
             log.debug("Not starting Dev Services for Neo4j, as it has been disabled in the config.");
             return null;
diff --git a/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java b/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
index fa0e133045a..d483f5735cd 100644
--- a/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
+++ b/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
@@ -69,7 +69,6 @@ public void shouldBeAbleToConnect() {
         }
     }
 
-    @Testcontainers(disabledWithoutDocker = true)
     static class WithLocallyDisabledDevServicesTest {
 
         @RegisterExtension
@@ -91,6 +90,25 @@ public void shouldNotBeAbleToConnect() {
         }
     }
 
+    static class WithGloballyDisabledDevServicesTest {
+
+        @RegisterExtension
+        static QuarkusUnitTest test = new QuarkusUnitTest()
+                .withEmptyApplication()
+                .setLogRecordPredicate(record -> true)
+                .withConfigurationResource("application.properties")
+                .overrideConfigKey("quarkus.devservices.enabled", "false");
+
+        @Inject
+        Driver driver;
+
+        @Test
+        public void shouldNotBeAbleToConnect() {
+
+            assertThatExceptionOfType(ServiceUnavailableException.class).isThrownBy(() -> driver.verifyConnectivity());
+        }
+    }
+
     @Testcontainers(disabledWithoutDocker = true)
     static class WithExplicitPropertyTest {