Skip to content
Snippets Groups Projects
Commit d817a33d authored by Krzysztof Witukiewicz's avatar Krzysztof Witukiewicz
Browse files

OZG-3936 OZG-7793 Autowire instead of constructor injection

parent eac0f4df
No related branches found
No related tags found
1 merge request!16Ozg 3936 refactor user profile url provider
......@@ -28,6 +28,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import org.apache.commons.lang3.reflect.ConstructorUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.stereotype.Component;
......@@ -44,16 +45,18 @@ import de.ozgcloud.common.errorhandling.TechnicalException;
@Component
public class LinkedUserProfileResourceSerializer extends JsonSerializer<Object> implements ContextualSerializer {
// need to autowire, because Spring calls the constructor without parameters
@Autowired
private final UserManagerUrlProvider userManagerUrlProvider;
private LinkedUserProfileResource annotation;
// for usage outside of Spring
private LinkedUserProfileResourceSerializer() {
this.userManagerUrlProvider = new UserManagerUrlProvider(new UserManagerProperties());
this(new UserManagerUrlProvider(new UserManagerProperties()));
}
public LinkedUserProfileResourceSerializer(UserManagerUrlProvider userManagerUrlProvider) {
private LinkedUserProfileResourceSerializer(UserManagerUrlProvider userManagerUrlProvider) {
this.userManagerUrlProvider = userManagerUrlProvider;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment