Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Support proxy-less @Configuration classes unchanged from a developer POV #30

Closed
sdeleuze opened this issue Aug 30, 2020 · 3 comments
Closed
Milestone

Comments

@sdeleuze
Copy link

See spring-attic/spring-native#248 for more details. We could probably start by doing such transformation only on configuration classes without @Bean to handle the default @SpringBootApplication case. Step 2 could be to do this transformation only if there is no cross @Bean method invocation. cc @aclement

@dsyer
Copy link
Contributor

dsyer commented Sep 2, 2020

Currently we don't modify user's code. I don't like doing that really. Don't you think it would be better to warn or fail?

@sdeleuze
Copy link
Author

sdeleuze commented Sep 9, 2020

I understand your hesitation but at the same time supporting Spring Boot application unchanged from a programming model perspective is a mandatory goal of ours IMO.

About that @aclement has raised a very interesting point that could change the scope of that issue.

With build time transformation it is possible to behave in the right way out of the box by modifying configuration classes directly to include the necessary guards around multiple requests to a bean method without creating any proxies... I wrote some code to do this in here: https://github.com/aclement/spring-boot-nox/blob/master/src/main/java/io/spring/nox/optimizer/collectors/ConfigurationClassCollectorRewriter.java#L195 - always correct behaviour with no configuration proxies.

I am not sure what kind of modification will be needed, but I tend to think some kind of modification on configuration classes will be needed at least for those with cross @Bean method invocations.

@sdeleuze sdeleuze changed the title Set proxyBeanMethods = false on configuration at build time when possible Support proxy-less @Configuration classes unchanged from a developper POV Sep 9, 2020
@dsyer dsyer changed the title Support proxy-less @Configuration classes unchanged from a developper POV Support proxy-less @Configuration classes unchanged from a developer POV Sep 14, 2020
@dsyer
Copy link
Contributor

dsyer commented Sep 15, 2020

Latest snapshots now support proxyBeanMethods=true by generating subclass implementations at build time and using those in the initializer.

@dsyer dsyer closed this as completed Sep 15, 2020
@dsyer dsyer added this to the 0.2.0 milestone Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants