Skip to content

Property values not properly loaded when method is annotated @ConditionalOnExpression #27718

@vvijayv

Description

@vvijayv

Affects: 2.5.4

Not all the properties are loaded when the bean is loaded based on the condition present in the configuration. Without the condition the values are loaded correctly.

   ```
@Bean
@ConditionalOnExpression("#{appProperties.approach2 eq false}")
public String approch2(AppProperties properties) {
	System.out.println(properties.message); //prints null
	System.out.println(properties.degree); //prints 0
	return "";
}

application.properties

application.message="some message"
application.degree=5
application.approach1=true
application.approach2=false

---

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions