org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loggingConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'server.port' in string value "${server.port}"

GitHub | Smitty010 | 4 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael and poroszd . Or join the community to write better ones.
  1. 0
    samebug tip
    Check if you don't have more than one instance of PropertySourcesPlaceholderConfigurer in your code, this might cause conflict.
  2. 0
    samebug tip
    You need to deploy aspectJ (aspectjweaver.jar) together with your application. Add it to your pom.xml
  3. 0

    Autowiring Using @Value and Optional Properties - DZone Java

    dzone.com | 1 month ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autowiredFakaSource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String miscillaneous.property_placeholder.AutowiredFakaSource.optional; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'optional'
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Captain Debug's Blog: Autowiring Using @Value and Optional Properties

    captaindebug.com | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autowiredFakaSource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String miscillaneous.property_placeholder.AutowiredFakaSource.optional; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'optional'
  6. 0
    samebug tip
    You could be missing na annotation (@Service or @Component) or the <bean> definition in the xml. Also, look if the class where your implementation is located is properly scanned (check "<context:component-scan base-package=")
    via goo.gl
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    Could not resolve placeholder 'server.port' in string value "${server.port}"

    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue()
  2. Spring Core
    AbstractPropertyResolver.resolveRequiredPlaceholders
    1. org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
    2. org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
    3. org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:219)
    4. org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:193)
    4 frames
  3. Spring Context
    PropertySourcesPlaceholderConfigurer$2.resolveStringValue
    1. org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:172)
    1 frame
  4. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:813)
    2. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1079)
    3. org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1059)
    4. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:589)
    5. org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    6. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370)
    7. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219)
    8. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
    9. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    10. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    11. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    12. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    13. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    14. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754)
    14 frames
  5. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    2 frames
  6. Spring Boot
    SpringApplication.run
    1. org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    2. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
    3. org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
    4. org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    4 frames
  7. com.mainstreamdata.myapp
    myappuserdbApp.main
    1. com.mainstreamdata.myapp.myappuserdbApp.main(myappuserdbApp.java:66)
    1 frame
  8. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  9. org.springframework.boot
    RestartLauncher.run
    1. org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
    1 frame