-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.objectstyle.di</groupId> | ||
<artifactId>di-comparison</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>springboot</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<main.class>org.objectstyle.springboot.Main</main.class> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.objectstyle.di</groupId> | ||
<artifactId>common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
<version>${springboot.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${springboot.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
22 changes: 22 additions & 0 deletions
22
springboot/src/main/java/org/objectstyle/springboot/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.objectstyle.springboot; | ||
|
||
import org.objectstyle.di.service.Service; | ||
import org.objectstyle.di.service.ServiceImpl; | ||
import org.objectstyle.di.service.SubService; | ||
import org.objectstyle.di.service.SubServiceImpl; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class Config { | ||
|
||
@Bean | ||
public Service service(SubService subService) { | ||
return new ServiceImpl(subService); | ||
} | ||
|
||
@Bean | ||
public SubService subService() { | ||
return new SubServiceImpl(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
springboot/src/main/java/org/objectstyle/springboot/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.objectstyle.springboot; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Main.class, args); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
springboot/src/main/java/org/objectstyle/springboot/Runner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.objectstyle.springboot; | ||
|
||
import org.objectstyle.di.service.Service; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class Runner implements CommandLineRunner { | ||
|
||
private Service service; | ||
|
||
public Runner(Service service) { | ||
this.service = service; | ||
} | ||
|
||
@Override | ||
public void run(String... args) throws Exception { | ||
System.out.println(service.doIt()); | ||
} | ||
} |