private Map<Integer, SpringBeansTarget> addTarget(ProfilerConfig config) {
        final Map<Integer, SpringBeansTarget> result = new HashMap<>();
        final Map<String, String> patterns = config.readPattern(PATTERN_REGEX);

        for (Map.Entry<String, String> entry : patterns.entrySet()) {
            try {
                final String key = entry.getKey();
                if (key == null || !key.startsWith(SPRING_BEANS_PREFIX)) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Invalid key format of spring-beans config {}={}", key, entry.getValue());
                    }
                    continue;
                }
                final int point = key.indexOf('.', SPRING_BEANS_PREFIX.length());
                if (point < 0) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Not found key number of spring-beans config {}={}", key, entry.getValue());
                    }
                    continue;
                }

                final int number = Integer.parseInt(key.substring(SPRING_BEANS_PREFIX.length(), point));
                SpringBeansTarget target = result.get(number);
                if (target == null) {
                    target = new SpringBeansTarget();
                    result.put(number, target);
                }

                if (key.endsWith(SPRING_BEANS_NAME_PATTERN_POSTFIX)) {
                    // bean name.
                    target.setNamePatterns(entry.getValue());
                } else if (key.endsWith(SPRING_BEANS_CLASS_PATTERN_POSTFIX)) {
                    // class name.
                    target.setClassPatterns(entry.getValue());
                } else if (key.endsWith(SPRING_BEANS_ANNOTATION_POSTFIX)) {
                    // annotation.
                    target.setAnnotations(entry.getValue());
                } else if (key.endsWith(SPRING_BEANS_SCOPE_POSTFIX)) {
                    // scope
                    target.setScope(entry.getValue());
                } else if (key.endsWith(SPRING_BEANS_BASE_PACKAGES_POSTFIX)) {
                    // base packages.
                    target.setBasePackages(entry.getValue());
                } else {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Unknown key format of spring-beans config. {}={}", key, entry.getValue());
                    }
                    continue;
                }
            } catch (Exception e) {
                if (logger.isInfoEnabled()) {
                    logger.info("Invalid spring-beans config. {}={}", entry.getKey(), entry.getValue());
                }
                continue;
            }
        }

        return result;
    }
@author Jongho Moon
@author jaehong.kim
agent-module/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/SpringBeansConfig.java