Skip to content

Rework @Configuration classes to be compatible with @Configuration(proxyBeanMethods=false) #1345

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

Closed
wilkinsona opened this issue Mar 9, 2019 · 5 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

Juergen has just merged support for @Configuration(proxyBeanMethods=false) into Framework 5.2 snapshots. We’re going to make as much use of that as possible in Boot 2.2.0.M2 (spring-projects/spring-boot#9068). There’s a configuration class in Boot where we need @Bean methods to be proxied because they subclass a Spring Session configuration class that requires it. The class in question is o.s.b.a.s.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration which is a subclass of o.s.s.d.r.c.a.w.h.RedisHttpSessionConfiguration. Could you please consider reworking things in Spring Session so that the proxy isn’t needed?

@vpavic vpavic self-assigned this Mar 11, 2019
@wilkinsona wilkinsona changed the title Rework RedisHttpSessionConfiguration to be compatible with @Configuration(proxyBeanMethods=false) Rework @Configuration classes to be compatible with @Configuration(proxyBeanMethods=false) Mar 12, 2019
@wilkinsona
Copy link
Member Author

wilkinsona commented Mar 12, 2019

Beyond reworking RedisHttpSessionConfiguration, it would be beneficial if all of Spring Session's @Configuration classes that are intended to be sub-classed by users could be annotated with @Configuration(proxyBeanMethods=false) to indicate that they do not require proxying. I believe those classes are (at least) the following:

  • HazelcastHttpSessionConfiguration
  • JdbcHttpSessionConfiguration
  • RedisHttpSessionConfiguration
  • RedisWebSessionConfiguration

@vpavic
Copy link
Contributor

vpavic commented Mar 12, 2019

I was about to ask whether only RedisHttpSessionConfiguration is affected by this. If we are to change patterns used in our @Configuration classes, we'd probably like to apply it consistently throughout the codebase.

@vpavic vpavic added this to the 2.2.0.M1 milestone Mar 12, 2019
@vpavic vpavic added the type: enhancement A general enhancement label Mar 12, 2019
@wilkinsona
Copy link
Member Author

Doing it consistently across all @Configuration classes, and not just those that users may sub-class, is worthwhile if you have the time to do it. You should see faster startup times and reduced memory usage (both heap and non-heap memory).

@vpavic
Copy link
Contributor

vpavic commented Mar 14, 2019

After taking a closer look at the problem, the originally reported problem will be fairly simple to address in RedisHttpSessionConfiguration and we're going to do it in #1362.

Reworking our @Configuration classes to be able to marked as proxyBeanMethods = false is something that will require more substantial changes, mostly due to those classes implementing ImportAware. We'll leave this issue open to track that effort.

@vpavic vpavic modified the milestones: 2.2.0.M1, 2.2.0.M2 Apr 11, 2019
@vpavic vpavic closed this as completed in b98c521 May 9, 2019
@vpavic
Copy link
Contributor

vpavic commented May 9, 2019

This is now resolved thanks to Framework's changes in ImportAware handling made in spring-projects/spring-framework#22920 (thanks for the ping @eleftherias).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants