micronaut-projects / micronaut-projects/micronaut-core
@Replace fails when run inside Eclipse
- Dominant language
- Java
- Stars
- 6.4k
- Forks
- 1.2k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 222
Description
This issue is causing problems as I cannot step into code as it never gets run. But when run from the command line, it all works fine. I've tried running `./gradlew eclipse` and the re-importing the project, but that does not work.
### Steps to Reproduce
* Created a default application and configured for security and JWT
* Enabled `login` endpoint
* Created the following class:
```
@Replaces(DefaultLdapGroupProcessor.class)
@Singleton
public class LdapGroupMapper extends DefaultLdapGroupProcessor {
private static final Map LDAP_TO_ROLE = Map.of("QA", "QA");
@Override
public Optional processGroup(final String group) {
log.debug("Attempting to map ldap role: {}", group);
final var opt = Optional.ofNullable(LDAP_TO_ROLE.get(group));
if (opt.isEmpty()) {
log.debug("No mapping for ldap group: {}", group);
} else {
log.debug("Mapped ldap group {} onto role: {}", group, opt.get());
}
return opt;
}
}
```
### Expected Behaviour
When run i would expect a response to contain only a single role `QA`
### Actual Behaviour
Instead I get all the roles from our LDAP server.
### Environment Information
- Ubuntu 19.04 (5.0.0-20-generic)
- Micronaut 1.2.0.RC2
- OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu219.04.1)
### Test Project
Can be located here: https://github.com/KangoV/mn-test-replaces
Contributor guide
Research direction
Start with the @Replaces(DefaultLdapGroupProcessor.class) example and the linked mn-test-replaces project, comparing behavior after ./gradlew eclipse and re-importing in Eclipse with the command-line run. Trace why the replacement is not active in Eclipse and verify the login response contains only the QA role.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100