package uk.co.ticklethepanda.carto.apps.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import uk.co.ticklethepanda.carto.core.projection.Projector;

@Configuration
public class ProjectionConfig {

    @Bean(name = "projector")
    public Projector projector(
            @Value("${location.history.heatmap.projector}") String projectorName
    ) throws ClassNotFoundException, IllegalAccessException, InstantiationException {

        Class<?> projectorClass = Class.forName(projectorName);

        Object projector = projectorClass.newInstance();

        if (!(projector instanceof Projector)) {
            throw new IllegalArgumentException("\"location.history.heatmap.projector\" must be a type of Projector");
        }

        return (Projector) projector;

    }
}

@@ -280,16 +280,69 @@
 ector;%0A%0A
+import java.lang.reflect.InvocationTargetException;%0A%0A
 @Configu
@@ -560,16 +560,28 @@
 ception,
+%0A           
  Illegal
@@ -596,16 +596,28 @@
 ception,
+%0A           
  Instant
@@ -631,16 +631,90 @@
 xception
+,%0A            NoSuchMethodException,%0A            InvocationTargetException
  %7B%0A%0A    
@@ -816,16 +816,41 @@
 orClass.
+getDeclaredConstructor().
 newInsta

Use non-deprecated new instance method