Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beans are not getting created or exposed to get utilized - Spring Boot 3.0.0 and above #34434

Closed
pawank0411 opened this issue Mar 2, 2023 · 5 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@pawank0411
Copy link

pawank0411 commented Mar 2, 2023

Spring Boot version : 3.0.3 and 3.0.2
Java version : 17

There is a demo java spring boot application which consumes a logger java spring boot project (which is exposed as a maven dependency) which basically has some aspects written to intercept the controller and service class method to print ENTRY and EXIT logs. Post performing the upgrade to the logger library project with spring boot 3.0.3 there were no beans getting created for the classes like the aspect classes, classes annotated with @RestController etc. Then, I downgraded the version of spring boot to 3.0.2 and with this beans started getting created and I was able to see the beans reflecting in /actuator/beans endpoint for logger application.

Now, this upgraded library (logger application) got consumed in the demo application which is also running on spring boot 3.0.2 and when I tried to hit /actuator/beans inside the demo application, I was not getting any classes (aspect classes) which are exposed as a beans from the logger application.

Is there any changes made to spring aop as part of the spring framework 6 ? or is there any additional steps got added to expose a bean so that it can be utilized in different application where the logger application is getting consumed.

Sample Configuration class (logger project) :

@Configuration
public class LoggerAutoConfiguration {

@Bean
@ConditionalProperty(name = "logger.logging.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
public LoggerLoggingAspect configureLoggerAspect() {
return new LoggerLoggingAspect();
}
}

POM demo application :

.....
<dependency>
<groupId>com.custom.logger</groupId>
<artifactId>logger-custom</artifactId>
<version>someVersion</version>
</dependency>
.....
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 2, 2023
@pawank0411 pawank0411 changed the title Beans are not getting created or exposed to utilize in spring aop 3.0.0 and above Beans are not getting created or exposed to get utilized - Spring Boot 3.0.0 and above Mar 2, 2023
@wilkinsona
Copy link
Member

This sounds like a duplicate of #34379. Do you have any spaces or other unusual characters in the path of the application?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Mar 2, 2023
@pawank0411
Copy link
Author

I was having some spaces in both the logger and demo application. Post removing the spaces, yes the beans were reflecting with spring boot 3.0.3.

But I am still not able to see the beans of logger application in /actuator/beans endpoint for demo application. That means beans are still not getting exposed from logger application to demo application, provided there is no space in the application path.

Spring Boot version : 3.0.0
Spring Framework version : 6.0.4
Java : 17

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 2, 2023
@wilkinsona
Copy link
Member

Thanks for the update.

But I am still not able to see the beans of logger application in /actuator/beans endpoint for demo application. That means beans are still not getting exposed from logger application to demo application, provided there is no space in the application path.

I can't tell why that would be happening from the little that you have described so far. One guess is that your logger library hasn't been updated to use the new AutoConfiguration.imports file. If that doesn't help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Mar 2, 2023
@pawank0411
Copy link
Author

Thanks @wilkinsona - Updated the library with new AutoConfiguration.imports.file

It works now.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2023
@wilkinsona
Copy link
Member

Thanks for letting us know.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants