'Trying to create dynamic ES Index facing java.lang.ClassNotFoundException: org.springframework.data.spel.ExpressionDependencies
Using <spring-boot.version>2.3.9.RELEASE</spring-boot.version> added following dependencies :
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
Trying to create dynamic ES Index
@Document(indexName = "test_#{@commonConfig.getEnv()}_v1")
@Component("commonConfig")
public class CommonConfig {
@Value("${spring.profiles.active}")
private String env;
public String getEnv() {
return env.toLowerCase(Locale.ROOT);
}
}
Solution 1:[1]
Boot 2.3.x is no longer supported https://spring.io/projects/spring-boot#support the last release was 2.3.12 last summer.
In any case, Boot 2.3.x uses spring-data-commons 2.3.x (2.3.9 pulls in 2.3.7).
ExpressionDependencies was not added to spring-data-commons until 2.4, so you have some mismatched dependencies somehow.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gary Russell |
