- category: mandatory
  customVariables: []
  description: Legacy configuration with io.konveyor.demo.config.ApplicationConfiguration
  effort: 1
  labels:
  - konveyor.io/source=traditional-corporate-framework
  - konveyor.io/target=cloud-corporate-framework
  - configuration
  links:
  - title: Spring Documentation - PropertySource javadoc
    url: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/PropertySource.html
  - title: Mkyong - Spring @PropertySource example
    url: https://mkyong.com/spring/spring-propertysources-example/
  - title: Baeldung - Properties with Spring and Spring Boot
    url: https://www.baeldung.com/properties-with-spring
  message: "\n The legacy ApplicationConfiguration class is being used in this application.
    This is discouraged by the migration\n guidelines, and should be replaced by a
    more standard approach using Spring's @PropertySource annotation and Environment
    class:\n\n\n ```java\n @PropertySource(\"classpath:persistence.properties\")\n
    public class PersistenceConfig {{\n @Autowired\n private Environment env;\n\n
    @Bean\n public DataSource dataSource() {{\n final DriverManagerDataSource dataSource
    = new DriverManagerDataSource();\n dataSource.setDriverClassName(env.getProperty(\"jdbc.driverClassName\"));\n
    dataSource.setUrl(env.getProperty(\"jdbc.url\"));\n dataSource.setUsername(env.getProperty(\"jdbc.user\"));\n
    dataSource.setPassword(env.getProperty(\"jdbc.password\"));\n\n return dataSource;\n
    }}\n }}\n ```\n\n\n\n This allows externalizing the configuration in Kubernetes
    by injecting it as a ConfigMap or a Secret in the lib directory from the\n container
    running the Tomcat instance.\n "
  ruleID: corporate-config-01000
  when:
    java.referenced:
      location: VARIABLE_DECLARATION
      pattern: io.konveyor.demo.config.ApplicationConfiguration
