Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lc-nyovchev/lombok-spring-qualifier

Repository files navigation

lombok-spring-qualifier

Small project demonstrating that the constructor injection of @Qualifier beans is now possible with lombok

Check out the test folder where there is a service wired like that:

@Service
@Getter
@RequiredArgsConstructor
public class LombokInjectorTestService {
	@Qualifier(DESTINATION_ONE) @NonNull private final Destination destination1;
	@Qualifier(DESTINATION_TWO) @NonNull private final Destination destination2;
}

NOTE: Keep in mind that this functionality was introduced in lombok 1.18.4 and it requires placing a lombok.config file in the root of your dir, looking like that:

# Copy the Qualifier annotation from the instance variables to the constructor
# see https://github.com/rzwitserloot/lombok/issues/745
lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Qualifier

How to install and run the tests

Install SDKMAN!

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

Install java and run the tests:

sdk env install
./mvnw clean test

About

Small project demonstrating that the constructor injection of @qualifier beans is now possible with lombok

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages