diff --git a/SPR-17166/pom.xml b/SPR-17166/pom.xml new file mode 100644 index 00000000..2782d28d --- /dev/null +++ b/SPR-17166/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + xxx + xxx + 0.0.1-SNAPSHOT + + org.springframework.boot + spring-boot-starter-parent + 2.0.4.RELEASE + + + + org.springframework.boot + spring-boot-starter + + + \ No newline at end of file diff --git a/SPR-17166/src/main/java/xxx/Application.java b/SPR-17166/src/main/java/xxx/Application.java new file mode 100644 index 00000000..8a92cff7 --- /dev/null +++ b/SPR-17166/src/main/java/xxx/Application.java @@ -0,0 +1,43 @@ +package xxx; + +import java.time.Instant; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +@SpringBootApplication +@EnableScheduling +public class Application { + + @Service + @Scope(proxyMode = ScopedProxyMode.TARGET_CLASS) + public static class A { + + @Scheduled(fixedDelay = 1000) + public void task() { + System.out.println(Instant.now()); + } + + } + + @Service + public static class B { + + private final A a; + + B(A a) { + this.a = a; + } + + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} \ No newline at end of file