Fix OpenSearchProperties Environment injection for integration tests
Add @Autowired annotation to setEnvironment() method to ensure Spring properly injects Environment instance. This enables legacy property fallback logic in @PostConstruct init() method during integration tests. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.convert.DurationUnit;
|
||||
import org.springframework.core.env.Environment;
|
||||
@@ -307,6 +308,7 @@ public class OpenSearchProperties {
|
||||
return environment != null && environment.containsProperty(NEW_PREFIX + propertyName);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user