<commit_before>package com.ofg.infrastructure.property;

import com.ofg.infrastructure.property.decrypt.JceUnlimitedStrengthUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClientConfiguration;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered;
import org.springframework.core.io.Resource;
import org.springframework.security.crypto.encrypt.TextEncryptor;

@Import(ZookeeperDiscoveryClientConfiguration.class)
@ImportAutoConfiguration(ZookeeperAutoConfiguration.class)
@Configuration
@Profile("!test")
public class ExternalPropertiesConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {

    @Autowired(required = false)
    private TextEncryptor textEncryptor;

    @Bean
    public FileSystemLocator fileSystemLocator(AppCoordinates appCoordinates) {
        return new FileSystemLocator(
                PropertiesFolderFinder.find(),
                appCoordinates,
                textEncryptor == null ? new FailsafeTextEncryptor() : textEncryptor);
    }<commit_msg>Fixing failsafe encryptor substitution<commit_after>package com.ofg.infrastructure.property;

import com.ofg.infrastructure.property.decrypt.JceUnlimitedStrengthUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClientConfiguration;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered;
import org.springframework.core.io.Resource;
import org.springframework.security.crypto.encrypt.TextEncryptor;

@Import(ZookeeperDiscoveryClientConfiguration.class)
@ImportAutoConfiguration(ZookeeperAutoConfiguration.class)
@Configuration
@Profile("!test")
public class ExternalPropertiesConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {

    @Autowired(required = false)
    private TextEncryptor textEncryptor;

    @Bean
    public FileSystemLocator fileSystemLocator(AppCoordinates appCoordinates) {
        return new FileSystemLocator(
                PropertiesFolderFinder.find(),
                appCoordinates,
                encryptor());
    }
    
    private TextEncryptor encryptor() {
        return (textEncryptor == null || textEncryptor.getClass().getSimpleName().equals("NoOpTextEncryptor"))
                ? new FailsafeTextEncryptor()
                : textEncryptor;
    }
{'fraction_non_alphanumeric': 0.0782472613458529, 'fraction_numerical': 0.0, 'mean_word_length': 6.249527410207939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2283148', 'n_tokens_mistral': 964, 'n_tokens_neox': 947, 'n_words': 141}