diff --git a/core/src/main/java/org/sql2o/Connection.java b/core/src/main/java/org/sql2o/Connection.java index f960a11a..f73ff126 100644 --- a/core/src/main/java/org/sql2o/Connection.java +++ b/core/src/main/java/org/sql2o/Connection.java @@ -58,6 +58,13 @@ public Connection setRollbackOnClose(boolean rollbackOnClose) { final boolean autoClose; + /** + * Adds CDI's dependency injection support + */ + Connection() { + this.autoClose = false; + } + Connection(Sql2o sql2o, boolean autoClose) { this(sql2o, null, autoClose); } diff --git a/core/src/main/java/org/sql2o/Sql2o.java b/core/src/main/java/org/sql2o/Sql2o.java index 9202c8f8..2b712862 100644 --- a/core/src/main/java/org/sql2o/Sql2o.java +++ b/core/src/main/java/org/sql2o/Sql2o.java @@ -4,6 +4,7 @@ import org.sql2o.connectionsources.ConnectionSource; import org.sql2o.logging.LocalLoggerFactory; import org.sql2o.logging.Logger; +import org.sql2o.quirks.NoQuirks; import org.sql2o.quirks.Quirks; import org.sql2o.quirks.QuirksDetector; @@ -35,6 +36,13 @@ public class Sql2o { private final static Logger logger = LocalLoggerFactory.getLogger(Sql2o.class); + /** + * Adds CDI's dependency injection support + */ + Sql2o() { + quirks = new NoQuirks(); + } + public Sql2o(String jndiLookup) { this(JndiDataSource.getJndiDatasource(jndiLookup)); }