diff --git a/.gitignore b/.gitignore index ca59e66..acb8ce3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.iml .idea -target -dependency-reduced-pom.xml +out +build +.gradle +.DS_Store diff --git a/README.md b/README.md index 3c48a93..19eef0a 100644 --- a/README.md +++ b/README.md @@ -10,36 +10,48 @@ Processing". ## "Benchmark" ``` -# Build (can't compare build times, as module ordering affects the results) -mvn clean package +# Build +./gradlew clean build installDist distTar ``` ``` # Get the file sizes -find . -name '*.jar' |xargs ls -l |grep -v original |grep -v common +find . -name '*.tar' |xargs ls -lh |grep -v original |grep -v common ``` ``` # Execution time -time java -jar ./bootique2/target/bootique2-*.jar -time java -jar ./cayennedi/target/cayennedi-*.jar -time java -jar ./dagger/target/dagger-*.jar -time java -jar ./guice/target/guice-*.jar -time java -jar ./owb/target/owb-*.jar -time java -jar ./spring/target/spring-*.jar -time java -jar ./springboot/target/springboot-*.jar - +time (for i in {1..10}; do ./baseline/build/install/baseline/bin/baseline; done) +time (for i in {1..10}; do ./bootique2/build/install/bootique2/bin/bootique2; done) +time (for i in {1..10}; do ./cayennedi/build/install/cayennedi/bin/cayennedi; done) +time (for i in {1..10}; do ./dagger/build/install/dagger/bin/dagger; done) +time (for i in {1..10}; do ./guice/build/install/guice/bin/guice; done) +time (for i in {1..10}; do ./komodo/build/install/komodo/bin/komodo; done) +time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done) +time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done) +time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done) +time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done) +time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done) +time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done) +time (for i in {1..10}; do ./komodo/build/install/komodo/bin/komodo; done) +time (for i in {1..10}; do ./guice/build/install/guice/bin/guice; done) +time (for i in {1..10}; do ./dagger/build/install/dagger/bin/dagger; done) +time (for i in {1..10}; do ./cayennedi/build/install/cayennedi/bin/cayennedi; done) +time (for i in {1..10}; do ./bootique2/build/install/bootique2/bin/bootique2; done) +time (for i in {1..10}; do ./baseline/build/install/baseline/bin/baseline; done) ``` -## Results (Java 8) +## Results (JDK 11) -|DI|Jar w/Deps Size, KB|:arrow_down: Exec time, ms| +|DI|Jar w/Deps Size, Mb|:arrow_down: Exec time, s| |----|-----|----| -|Dagger|46|104| -|Cayenne DI|79|120| -|Bootique 2|2522|244| -|Guice|3781|328| -|OpenWebBeans|1345|381| -|Spring|3954|355| -|Spring Boot|7824|1057| +|Baseline|1.7|1.35| +|Dagger|1.7|1.41| +|Cayenne DI|1.8|2.05| +|Bootique 2|4.2|4.31| +|Guice|5.4|6.22| +|Komodo|6.4|7.56| +|Spring|5.5|8.36| +|OpenWebBeans|3.0|10.02| +|Spring Boot|9.2|26.94| diff --git a/baseline/build.gradle.kts b/baseline/build.gradle.kts new file mode 100644 index 0000000..9fd5e1b --- /dev/null +++ b/baseline/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + kotlin("jvm").version("1.4.30-M1") + application +} + +application { + mainClass.set("org.objectstyle.baseline.MainKt") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation(kotlin("stdlib-jdk8")) +} diff --git a/baseline/src/main/java/org/objectstyle/baseline/Main.kt b/baseline/src/main/java/org/objectstyle/baseline/Main.kt new file mode 100644 index 0000000..53b5f3e --- /dev/null +++ b/baseline/src/main/java/org/objectstyle/baseline/Main.kt @@ -0,0 +1,10 @@ +package org.objectstyle.baseline + +import org.objectstyle.di.service.ServiceImpl +import org.objectstyle.di.service.SubServiceImpl + +fun main() { + val s = ServiceImpl(SubServiceImpl()) + + println(s.doIt()) +} diff --git a/bootique2/build.gradle.kts b/bootique2/build.gradle.kts new file mode 100644 index 0000000..6c60bf3 --- /dev/null +++ b/bootique2/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.bootique2.Main") +} + +repositories { + jcenter() + maven { + url = uri("https://maven.objectstyle.org/nexus/content/repositories/bootique-snapshots/") + } +} + +dependencies { + implementation(project(":common")) + + implementation("io.bootique:bootique:2.0-SNAPSHOT") +} diff --git a/bootique2/pom.xml b/bootique2/pom.xml deleted file mode 100644 index 85ac037..0000000 --- a/bootique2/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - bootique2 - jar - - - org.objectstyle.bootique2.Main - - - - - - io.bootique.bom - bootique-bom - ${bootique2.version} - import - pom - - - - - - - org.objectstyle.di - common - ${project.version} - - - io.bootique - bootique - - - - - - - maven-shade-plugin - - - - - \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..e69de29 diff --git a/cayennedi/build.gradle.kts b/cayennedi/build.gradle.kts new file mode 100644 index 0000000..bca67bf --- /dev/null +++ b/cayennedi/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.cayenne.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("org.apache.cayenne:cayenne-di:4.1.RC2") +} diff --git a/cayennedi/pom.xml b/cayennedi/pom.xml deleted file mode 100644 index c8a01fb..0000000 --- a/cayennedi/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - cayennedi - - jar - - - org.objectstyle.cayenne.Main - - - - - org.objectstyle.di - common - ${project.version} - - - org.apache.cayenne - cayenne-di - ${cayenne.version} - - - - - - - maven-shade-plugin - - - - - \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 0000000..b0b3f0e --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + kotlin("jvm").version("1.4.30-M1") +} + +repositories { + jcenter() +} + +dependencies { + implementation(kotlin("stdlib-jdk8")) +} diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index a05f8de..0000000 --- a/common/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - common - jar - - \ No newline at end of file diff --git a/common/src/main/java/org/objectstyle/di/service/Service.kt b/common/src/main/java/org/objectstyle/di/service/Service.kt index 2b24af0..6943d89 100644 --- a/common/src/main/java/org/objectstyle/di/service/Service.kt +++ b/common/src/main/java/org/objectstyle/di/service/Service.kt @@ -1,7 +1,5 @@ -package org.objectstyle.di.service; +package org.objectstyle.di.service - -public interface Service { - - String doIt(); +interface Service { + fun doIt(): String } diff --git a/common/src/main/java/org/objectstyle/di/service/ServiceImpl.kt b/common/src/main/java/org/objectstyle/di/service/ServiceImpl.kt index 69f38e3..a666a56 100644 --- a/common/src/main/java/org/objectstyle/di/service/ServiceImpl.kt +++ b/common/src/main/java/org/objectstyle/di/service/ServiceImpl.kt @@ -1,14 +1,9 @@ -package org.objectstyle.di.service; +package org.objectstyle.di.service -public class ServiceImpl implements Service { - - private SubService subService; - - public ServiceImpl(SubService subService) { - this.subService = subService; - } - - public String doIt() { - return "ServiceImpl_" + subService.doIt(); +class ServiceImpl( + private val subService: SubService +) : Service { + override fun doIt(): String { + return "ServiceImpl_" + subService.doIt() } } diff --git a/common/src/main/java/org/objectstyle/di/service/SubService.kt b/common/src/main/java/org/objectstyle/di/service/SubService.kt index a46b032..bf291c1 100644 --- a/common/src/main/java/org/objectstyle/di/service/SubService.kt +++ b/common/src/main/java/org/objectstyle/di/service/SubService.kt @@ -1,5 +1,5 @@ -package org.objectstyle.di.service; +package org.objectstyle.di.service -public interface SubService { - String doIt(); +interface SubService { + fun doIt(): String } diff --git a/common/src/main/java/org/objectstyle/di/service/SubServiceImpl.kt b/common/src/main/java/org/objectstyle/di/service/SubServiceImpl.kt index dc41949..607a925 100644 --- a/common/src/main/java/org/objectstyle/di/service/SubServiceImpl.kt +++ b/common/src/main/java/org/objectstyle/di/service/SubServiceImpl.kt @@ -1,8 +1,7 @@ -package org.objectstyle.di.service; +package org.objectstyle.di.service -public class SubServiceImpl implements SubService { - - public String doIt() { - return "SubServiceImpl"; +class SubServiceImpl : SubService { + override fun doIt(): String { + return "SubServiceImpl" } } diff --git a/dagger/build.gradle.kts b/dagger/build.gradle.kts new file mode 100644 index 0000000..1d8e4f8 --- /dev/null +++ b/dagger/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.dagger.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("com.google.dagger:dagger:2.30.1") + annotationProcessor("com.google.dagger:dagger-compiler:2.30.1") +} diff --git a/dagger/pom.xml b/dagger/pom.xml deleted file mode 100644 index 1c895ee..0000000 --- a/dagger/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - dagger - jar - - - org.objectstyle.dagger.Main - - - - - org.objectstyle.di - common - ${project.version} - - - com.google.dagger - dagger - ${dagger.version} - - - com.google.dagger - dagger-compiler - ${dagger.version} - provided - - - - - - - maven-shade-plugin - - - - - \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f1577bd --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionSha256Sum=a7ca23b3ccf265680f2bfd35f1f00b1424f4466292c7337c85d46c9641b3f053 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/guice/build.gradle.kts b/guice/build.gradle.kts new file mode 100644 index 0000000..bbded40 --- /dev/null +++ b/guice/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.guice.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("com.google.inject:guice:4.2.3") +} diff --git a/guice/pom.xml b/guice/pom.xml deleted file mode 100644 index 52b3d16..0000000 --- a/guice/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - guice - jar - - - org.objectstyle.guice.Main - - - - - org.objectstyle.di - common - ${project.version} - - - com.google.inject - guice - ${guice.version} - - - - - - - maven-shade-plugin - - - - - \ No newline at end of file diff --git a/komodo/build.gradle.kts b/komodo/build.gradle.kts new file mode 100644 index 0000000..f0ab37a --- /dev/null +++ b/komodo/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + kotlin("jvm").version("1.4.30-M1") + application +} + +application { + mainClass.set("org.objectstyle.komodo.MainKt") +} + +tasks.withType().configureEach { + kotlinOptions.jvmTarget = "11" +} + +repositories { + jcenter() + maven { + url = uri("https://dl.bintray.com/heapy/heap-dev") + } +} + +dependencies { + implementation(project(":common")) + + implementation(kotlin("stdlib-jdk8")) + implementation("io.heapy.komodo:komodo-di:0.1.0-development+000084") +} diff --git a/komodo/src/main/java/org/objectstyle/komodo/Main.kt b/komodo/src/main/java/org/objectstyle/komodo/Main.kt new file mode 100644 index 0000000..ca8733c --- /dev/null +++ b/komodo/src/main/java/org/objectstyle/komodo/Main.kt @@ -0,0 +1,21 @@ +package org.objectstyle.komodo + +import io.heapy.komodo.di.createContextAndGet +import io.heapy.komodo.di.module +import io.heapy.komodo.di.provide +import io.heapy.komodo.di.type +import org.objectstyle.di.service.Service +import org.objectstyle.di.service.ServiceImpl +import org.objectstyle.di.service.SubService +import org.objectstyle.di.service.SubServiceImpl + +suspend fun main() { + val s = createContextAndGet(type(), mainModule) + println(s.doIt()) +} + +val mainModule by module { + provide(::ServiceImpl) + provide(::SubServiceImpl) +} + diff --git a/owb/build.gradle.kts b/owb/build.gradle.kts new file mode 100644 index 0000000..a5cec92 --- /dev/null +++ b/owb/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.owb.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("org.apache.geronimo.specs:geronimo-annotation_1.3_spec:1.0") + implementation("org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0") + implementation("org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.0") + implementation("org.apache.geronimo.specs:geronimo-interceptor_1.2_spec:1.0") + implementation("org.apache.openwebbeans:openwebbeans-impl:2.0.16") + implementation("org.apache.openwebbeans:openwebbeans-spi:2.0.16") + implementation("org.apache.openwebbeans:openwebbeans-se:2.0.16") +} diff --git a/owb/pom.xml b/owb/pom.xml deleted file mode 100644 index 27ebd21..0000000 --- a/owb/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - owb - jar - - - org.objectstyle.owb.Main - - - - Apache OpenWebBeans is a full featured JavaEE 8 level CDI container. - This is not a trimmed down version but really full EE8... - - More info at https://openwebbeans.apache.org - - - - - - org.objectstyle.di - common - ${project.version} - - - - - org.apache.geronimo.specs - geronimo-annotation_1.3_spec - 1.0 - - - org.apache.geronimo.specs - geronimo-atinject_1.0_spec - 1.0 - - - org.apache.geronimo.specs - geronimo-jcdi_2.0_spec - 1.0 - - - org.apache.geronimo.specs - geronimo-interceptor_1.2_spec - 1.0 - - - - - org.apache.openwebbeans - openwebbeans-impl - ${owb.version} - - - org.apache.openwebbeans - openwebbeans-spi - ${owb.version} - - - org.apache.openwebbeans - openwebbeans-se - ${owb.version} - - - - - - - - maven-shade-plugin - - - - - - - - - org.apache.openwebbeans - openwebbeans-maven - ${owb.version} - - - - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index b5ccfb3..0000000 --- a/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - 4.0.0 - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - pom - - - 1.8 - 1.8 - - 2.0-SNAPSHOT - 2.27 - 4.2.3 - 4.1.RC2 - 2.0.16 - 5.2.5.RELEASE - 2.2.6.RELEASE - - - - common - bootique2 - dagger - guice - cayennedi - spring - springboot - owb - - - - - snapshots - https://maven.objectstyle.org/nexus/content/repositories/linkrest-snapshots - - false - - - true - - - - - central - https://repo1.maven.org/maven2 - - true - - - false - - - - - - - - - maven-compiler-plugin - 3.8.1 - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.3 - - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - ${main.class} - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - true - - - - - - - - - \ No newline at end of file diff --git a/results1_1.ods b/results1_1.ods deleted file mode 100644 index 796920e..0000000 Binary files a/results1_1.ods and /dev/null differ diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..19d0bcd --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,10 @@ +include("common") +include("baseline") +include("komodo") +include("bootique2") +include("dagger") +include("guice") +include("cayennedi") +include("spring") +include("springboot") +include("owb") diff --git a/spring/build.gradle.kts b/spring/build.gradle.kts new file mode 100644 index 0000000..70df69d --- /dev/null +++ b/spring/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.spring.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("org.springframework:spring-context:5.2.5.RELEASE") +} diff --git a/spring/pom.xml b/spring/pom.xml deleted file mode 100644 index 7146bf8..0000000 --- a/spring/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - spring - jar - - - org.objectstyle.spring.Main - - - - - org.objectstyle.di - common - ${project.version} - - - org.springframework - spring-context - ${spring.version} - - - - - - - maven-shade-plugin - - - - - \ No newline at end of file diff --git a/springboot/build.gradle.kts b/springboot/build.gradle.kts new file mode 100644 index 0000000..fba8edf --- /dev/null +++ b/springboot/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + java + application +} + +application { + mainClass.set("org.objectstyle.springboot.Main") +} + +repositories { + jcenter() +} + +dependencies { + implementation(project(":common")) + + implementation("org.springframework.boot:spring-boot-starter:2.2.6.RELEASE") +} diff --git a/springboot/pom.xml b/springboot/pom.xml deleted file mode 100644 index ca6cafc..0000000 --- a/springboot/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - 4.0.0 - - - org.objectstyle.di - di-comparison - 1.1-SNAPSHOT - - - springboot - jar - - - org.objectstyle.springboot.Main - - - - - org.objectstyle.di - common - ${project.version} - - - org.springframework.boot - spring-boot-starter - ${springboot.version} - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${springboot.version} - - - - repackage - - - - - - - - \ No newline at end of file