openrewrite / openrewrite/rewrite-spring
ConditionalOnAnyBean should create new CompilationUnit when the condition is on the parent class
Open
Nobody has claimed this yet.
boot-2.0
bug
- Dominant language
- Java
- Stars
- 403
- Forks
- 149
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 10
Description
IMPORTANT the ConditionalOnAnyBean Recipe should ONLY be applied to spring-boot 1.x projects during the 2.x conversion
the following conversion does not compile
@ConditionalOnClass(Feign.class)
@ConditionalOnBean({ LoadBalancerClient.class, LoadBalancerClientFactory.class })
...
public class FeignLoadBalancerAutoConfiguration {}
converted to
@Conditional(ConditionLoadBalancerClientOrLoadBalancerClientFactory.class)
...
public class FeignLoadBalancerAutoConfiguration {
private static class ConditionLoadBalancerClientOrLoadBalancerClientFactory extends AnyNestedCondition {
...
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the ConditionalOnAnyBean Recipe and reproduce the shown Spring Boot 1.x-to-2.x conversion where the condition is on the parent class. Verify how the recipe creates the nested condition and ensure the resulting conversion creates the needed CompilationUnit and compiles, while remaining limited to Spring Boot 1.x projects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100