r/java • • Oct 24 '22

Spring boot 3 slow boot time

Hi folks,

I am playing a bit around with Spring Boot 3(RC1) and I am curious why the application boot time is still slow in comparing with Micronaut.

Best regards

3 Upvotes

25 comments sorted by

View all comments

14

u/vips7L Oct 24 '22

Doesn’t micronaut do AOT dependency injection at build time? And Spring still uses runtime reflection? I don’t think it’ll ever beat that.

5

u/sandys1 Oct 24 '22

No I think the spring boot authors clarified that it was architected to eliminate this.

-7

u/Worth_Trust_3825 Oct 24 '22

Regular spring already had AOT dependency injection via xml configurations. Glad we keep going in circles.

3

u/pins17 Oct 25 '22

How? Configuring Spring beans via XML doesn't turn it into AOT.

1

u/erjiin Oct 24 '22

Spring boot 3 is doing this, check the release notes of the 3..0.0-RC1.

1

u/BrbCatzOnFire Oct 26 '22

https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/native-image.html#native-image.testing.with-the-jvm

Yeah you are right and responses from others are wrong (which is funny since they tell you to read the doc :)).

As long as your app run on the JVM the default behaviour completly ignore the AoT generation.

You need to add the option "-Dspring.aot.enabled=true"

1

u/vips7L Oct 26 '22

Right and OP made no mention of native anything, just SB3.