Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1751

Spring boot microservice not falling back to default

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 2.5.1
    • None
    • Flow Builder: Java

    Description

      When we run application with pring profiles, it says its falling back to default but it never falls back to default and application exits

      reference error message from my application c.a.customer.CustomerApplication         : No active profile set, falling back to default

      Note: but when i edit configuration, add environment variable  SPRING_PROFILES_ACTIVE=default it works.

      _____   _    _    _____   _______    ____    __  __   ______   _____  / ____| | |  | |  / ____| |__   __|  / __ \  |  \/  | |  ____| |  __ \ | |      | |  | | | (___      | |    | |  | | | \  / | | |__    | |__) | | |      | |  | |  \___ \     | |    | |  | | | |\/| | |  __|   |  _  / | |____  | |__| |  ____) |    | |    | |__| | | |  | | | |____  | | \ \  \_____|  \____/  |_____/     |_|     \____/  |_|  |_| |______| |_|  \_\
      2022-04-03 13:12:43.331  INFO [customer,,] 77112 --- [           main] c.a.customer.CustomerApplication         : Starting CustomerApplication using Java 17.0.2 on ABHIDIVA-M-K96R with PID 77112 (/Users/abhidiva/Desktop/microservice_k8_distributed/abhilashgdservices/customer/target/classes started by abhidiv in /Users/abhidiva/Desktop/microservice_k8_distributed/abhilashgdservices)2022-04-03 13:12:43.332  INFO [customer,,] 77112 --- [           main] c.a.customer.CustomerApplication         : No active profile set, falling back to default profiles: default2022-04-03 13:12:43.393  WARN [customer,,] 77112 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.abhilashgd.customer.CustomerApplication]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:clients-${spring.profiles.active}.properties"2022-04-03 13:12:43.503 ERROR [customer,,] 77112 --- [           main] o.s.boot.SpringApplication               : Application run failed
      org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.abhilashgd.customer.CustomerApplication]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:clients-${spring.profiles.active}.properties" at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.7.jar:2.5.7] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765) ~[spring-boot-2.5.7.jar:2.5.7] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:445) ~[spring-boot-2.5.7.jar:2.5.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.7.jar:2.5.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-2.5.7.jar:2.5.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.7.jar:2.5.7] at com.abhilashgd.customer.CustomerApplication.main(CustomerApplication.java:25) ~[classes/:na]Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:clients-${spring.profiles.active}.properties" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-5.3.13.jar:5.3.13] at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-5.3.13.jar:5.3.13] at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.13.jar:5.3.13] at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.13.jar:5.3.13] at org.springframework.core.env.AbstractEnvironment.resolveRequiredPlaceholders(AbstractEnvironment.java:630) ~[spring-core-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassParser.processPropertySource(ConfigurationClassParser.java:461) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:280) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207) ~[spring-context-5.3.13.jar:5.3.13] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175) ~[spring-context-5.3.13.jar:5.3.13] ... 13 common frames omittedProcess finished with exit code 1
      

      Attachments

        Activity

          People

            rstoya05-aop Rossen Stoyanchev
            abhilashgd abhilashgd
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: