gavlyukovskiy / spring-boot-data-source-decorator

Spring Boot integration with p6spy, datasource-proxy, flexy-pool and spring-cloud-sleuth
Apache License 2.0
871 stars 83 forks source link

Spring Boot 3 Support #77

Closed LelvProgrammer closed 1 year ago

LelvProgrammer commented 1 year ago

It seems like the library is no longer working out of the box with Spring Boot 3. I read other people were having issues, and I tried it myself and wouldn't get the logs running. It'd seem as though some adaptation has to be made, but if anyone got it working with Spring Boot 3, please share.

igr commented 1 year ago

Second that. There are no logs in SrpingBoot3 :(

jewolz commented 1 year ago

Same here. Is there a new version planned to support Spring Boot 3?

gavlyukovskiy commented 1 year ago

I suspect that the main change is coming from new autoconfiguration declaration mechanism introduced in 2.7. I don't think it's going to be a huge change and I'll try to look into it.

ckdgus08 commented 1 year ago

If you create a configuration file, you can see logs even if you use spring 3.0.

@Profile("local", "test")
@Configuration
@Import(DataSourceDecoratorAutoConfiguration::class)
class SqlLoggingConfiguration

This is my console log. image

@LelvProgrammer @igr @jewolz

jewolz commented 1 year ago

I can confirm that with the additional DataSourceDecorator Config I also receive logs. However, funnily enough they are written to the spy.log file, even though I have decorator.datasource.p6spy.logging = SLF4j manually configured (actually it's the default value, but somehow not used)

@ckdgus08 Did you configure something specific there as well?

sushovan86 commented 1 year ago

The first thing (probably the easiest) that needs to be done is to change the import packages from javax to jakarta. E.g. com.github.gavlyukovskiy.boot.jdbc.decorator.p6spy.P6SpyConfiguration the imports javax.annotation.PostConstruct and javax.annotation.PreDestroy needs to be changed to jakarta.annotation.PostConstruct and jakarta.annotation.PreDestroy respectively.

gavlyukovskiy commented 1 year ago

Fixed via #78, released in 1.9.0

LelvProgrammer commented 1 year ago

Thanks mate - I'll tell stories about you to my grandchildren