I have an application that stopped working correctly after updating to 3.4.3. I have prepared a minimal app that reproduces the issue.
package com.example.demo;
import io.micrometer.core.annotation.Timed;
import io.micrometer.core.aop.TimedAspect;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
public TimedAspect timedAspect() {
return new TimedAspect();
}
@Service
public static class DemoService {
public DemoService(DemoFactory demoFactory) {
Thread initThread = new Thread(demoFactory::initSomething);
initThread.setName("DemoService-initThread");
initThread.start();
}
}
@Service
public static class DemoFactory {
@Timed(value = "init_timed")
void initSomething() {
System.out.println("INIT SOMETHING");
}
}
}
Output when running the application on 3.4.2:
:: Spring Boot :: (v3.4.2)
2025-02-28T22:08:46.129+01:00 INFO 53499 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 21.0.6 with PID 53499 (/somepath/spring-boot-issue-0/target/classes started by pedziwia in /somepath/spring-boot-issue-0)
2025-02-28T22:08:46.132+01:00 INFO 53499 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2025-02-28T22:08:46.700+01:00 INFO 53499 --- [vice-initThread] o.s.b.f.s.DefaultListableBeanFactory : Creating singleton bean 'timedAspect' in thread "DemoService-initThread" while other thread holds singleton lock for other beans [timedAspect]
2025-02-28T22:08:46.715+01:00 INFO 53499 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating singleton bean 'org.springframework.boot.actuate.autoconfigure.availability.AvailabilityHealthContributorAutoConfiguration' in thread "main" while other thread holds singleton lock for other beans []
INIT SOMETHING
2025-02-28T22:08:47.192+01:00 INFO 53499 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.287 seconds (process running for 1.728)
Disconnected from the target VM, address: '127.0.0.1:58305', transport: 'socket'
Process finished with exit code 0
Output when running the application on 3.4.3:
:: Spring Boot :: (v3.4.3)
2025-02-28T22:09:46.824+01:00 INFO 53949 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 21.0.6 with PID 53949 (/somepath/spring-boot-issue-0/target/classes started by pedziwia in /somepath/spring-boot-issue-0)
2025-02-28T22:09:46.827+01:00 INFO 53949 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2025-02-28T22:09:47.379+01:00 INFO 53949 --- [vice-initThread] o.s.b.f.s.DefaultListableBeanFactory : Creating singleton bean 'timedAspect' in thread "DemoService-initThread" while other thread holds singleton lock for other beans [timedAspect]
2025-02-28T22:09:47.857+01:00 INFO 53949 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.251 seconds (process running for 1.698)
The process does not terminate, it hangs forever and "INIT SOMETHING" is never printed.
I compared the classpath and found that downgrading the versions of two dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>6.2.2</version>
</dependency>
allows the program to start and work correctly again.
I have prepared a repository with a minimal app in Docker that reproduces this issue. https://github.com/180254/spring-boot-issue-44498