openrewrite / openrewrite/rewrite-spring

ConditionalOnAnyBean should create new CompilationUnit when the condition is on the parent class

Open
#34 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.