Skip to content

Commit

Permalink
Spring-XML
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Mar 13, 2021
1 parent 17094bb commit 768d79a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)
|spring|5.60|356|23|
|komodo|6.41|392|17|
|owb|3.05|421|35|
|spring-xml|5.60|430|19|
|springboot|9.73|916|42|

## Results for 100 classes (JDK 11)
Expand All @@ -66,5 +67,6 @@ OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)
|guice-deep|5.56|407|530|
|spring-deep|5.73|469|420|
|komodo-deep|6.64|531|114|
|spring-xml-deep|5.72|559|319|
|owb-deep|3.18|584|532|
|springboot-deep|9.85|1054|439|
11 changes: 6 additions & 5 deletions common-deep/src/test/kotlin/TestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ val projects = listOf(
"cayennedi",
"dagger",
"guice",
// "helidon",
"kodein",
"koin",
"koin-reflect",
"komodo",
"kotlin-lazy",
// "micronaut",
"owb",
// "quarkus",
"spring",
"spring-xml",
"springboot",
// TODO:
// "helidon",
// "micronaut",
// "quarkus",
// "spring-fu",
// "spring-index",
// "spring-scan",
// "spring-scan-large",
// "spring-xml",
"springboot",
// "springboot-index",
)

Expand Down
17 changes: 17 additions & 0 deletions spring-xml/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
kotlin("jvm").version("1.4.31")
application
}

application {
mainClass.set("io.heapy.spring.MainKt")
}

repositories {
mavenCentral()
}

dependencies {
implementation(project(":common"))
implementation("org.springframework:spring-context:5.3.4")
}
9 changes: 9 additions & 0 deletions spring-xml/src/main/java/io/heapy/spring/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.heapy.spring

import io.heapy.di.service.Service
import org.springframework.context.support.GenericXmlApplicationContext

fun main() {
val context = GenericXmlApplicationContext("classpath:beans.xml")
println(context.getBean(Service::class.java).doIt())
}
14 changes: 14 additions & 0 deletions spring-xml/src/main/resources/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<bean id="service" class="io.heapy.di.service.ServiceImpl">
<constructor-arg ref="subService"/>
</bean>

<bean id="subService" class="io.heapy.di.service.SubServiceImpl">
</bean>
</beans>

0 comments on commit 768d79a

Please sign in to comment.