The code below is defined in a shared module that is used by a couple of our apps, all using the same version of Spring.
@Component
public class CrowdRestAuthenticationManager implements SecurityManager {
private enum IAMObjectType {
USER,
GROUP
};
...
private List<String> getDirectParents(IAMObjectType objectType, String objectName, Predicate<String> filter)
throws IOException, InterruptedException {
objectName = URLEncoder.encode(objectName, "UTF-8");
String path;
switch (objectType) {
case USER:
path = String.format("/rest/usermanagement/1/user/group/direct?username=%s", objectName);
break;
case GROUP:
path = String.format("/rest/usermanagement/1/group/parent-group/direct?groupname=%s", objectName);
break;
default:
throw new RuntimeException("Unexpected objectType " + objectType);
}
...
}
private Collection<? extends GrantedAuthority> getWorkspaceBasedAuthorities(String username) {
// Get Workspace Roles
var workspaceMemberships = new HashMap<String, WorkspaceMembership>();
try {
List<String> workspacesRoles = getDirectParents(IAMObjectType.USER, username, getWorkspacePattern().asMatchPredicate());
...
}
}
}
I haven't defined any constructor for CrowdRestAuthenticationManager. All of the calls to getDirectParents are very much like the one demonstrated, calls from regular private instance methods within CrowdRestAuthenticationManager. The first argument is always a literal, one of the 2 enum values.

One of the apps (just one) won't start with the following error:
2022-06-23 10:57:33.541 WARN 75261 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdRestAuthenticationManager.IAMObjectType' defined in URL [jar:file:/Users/###/.m2/repository/###/core/0.0.1-SNAPSHOT/core-0.0.1-SNAPSHOT.jar!/###/security/CrowdRestAuthenticationManager$IAMObjectType.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Description:
Parameter 0 of constructor in ###.security.CrowdRestAuthenticationManager$IAMObjectType required a bean of type 'java.lang.String' that could not be found.
Action:
Consider defining a bean of type 'java.lang.String' in your configuration.
This doesn't make sense to me. Why is it trying to construct an instance of this enum at startup? I haven't been able to identify the difference between the apps that is causing only one to have this problem.
Thanks!