Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit 6af1f73

Browse files
committed
Add repro project for SPR-12725
1 parent 038e44c commit 6af1f73

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

SPR-12725/pom.xml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.test</groupId>
7+
<artifactId>SPR-12725</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
11+
<name>demo</name>
12+
<description>Demo project for Spring Boot</description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.2.2.BUILD-SNAPSHOT</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<start-class>demo.DemoApplication</start-class>
24+
<java.version>1.7</java.version>
25+
<spring.version>4.2.0.BUILD-SNAPSHOT</spring.version>
26+
</properties>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-test</artifactId>
36+
<scope>test</scope>
37+
</dependency>
38+
</dependencies>
39+
40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-maven-plugin</artifactId>
45+
</plugin>
46+
</plugins>
47+
</build>
48+
49+
<repositories>
50+
<repository>
51+
<id>spring-snapshots</id>
52+
<name>Spring Snapshots</name>
53+
<url>https://repo.spring.io/snapshot</url>
54+
<snapshots>
55+
<enabled>true</enabled>
56+
</snapshots>
57+
</repository>
58+
<repository>
59+
<id>spring-milestones</id>
60+
<name>Spring Milestones</name>
61+
<url>https://repo.spring.io/milestone</url>
62+
<snapshots>
63+
<enabled>false</enabled>
64+
</snapshots>
65+
</repository>
66+
</repositories>
67+
<pluginRepositories>
68+
<pluginRepository>
69+
<id>spring-snapshots</id>
70+
<name>Spring Snapshots</name>
71+
<url>https://repo.spring.io/snapshot</url>
72+
<snapshots>
73+
<enabled>true</enabled>
74+
</snapshots>
75+
</pluginRepository>
76+
<pluginRepository>
77+
<id>spring-milestones</id>
78+
<name>Spring Milestones</name>
79+
<url>https://repo.spring.io/milestone</url>
80+
<snapshots>
81+
<enabled>false</enabled>
82+
</snapshots>
83+
</pluginRepository>
84+
</pluginRepositories>
85+
86+
87+
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package demo;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
import org.springframework.context.event.EventListener;
5+
import org.springframework.stereotype.Component;
6+
7+
/**
8+
*
9+
* @author Stephane Nicoll
10+
*/
11+
@Configuration
12+
public class Components {
13+
14+
@Component
15+
static class FooListener {
16+
17+
@EventListener
18+
public Bar handle(Foo foo) {
19+
System.out.println("Got foo: " + foo);
20+
return new Bar();
21+
}
22+
}
23+
24+
@Component
25+
static class BarListener {
26+
27+
@EventListener
28+
public void handle(Bar bar) {
29+
System.out.println("Got bar: " + bar);
30+
}
31+
}
32+
33+
static class Foo {}
34+
35+
static class Bar {}
36+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package demo;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class DemoApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(DemoApplication.class, args);
11+
}
12+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package demo;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.boot.CommandLineRunner;
5+
import org.springframework.context.ApplicationEventPublisher;
6+
import org.springframework.stereotype.Component;
7+
8+
/**
9+
*
10+
* @author Stephane Nicoll
11+
*/
12+
@Component
13+
public class Startup implements CommandLineRunner {
14+
15+
private final ApplicationEventPublisher publisher;
16+
17+
@Autowired
18+
public Startup(ApplicationEventPublisher publisher) {
19+
this.publisher = publisher;
20+
}
21+
22+
@Override
23+
public void run(String... strings) throws Exception {
24+
this.publisher.publishEvent(new Components.Foo());
25+
}
26+
}

0 commit comments

Comments
 (0)