Unable to use spring-content-mongo in springboot application
garvbhandari opened this issue · 2 comments
garvbhandari commented
Describe the bug
Attempting to use spring-content-mongo in springboot(3.2.6) application results in an error -
java.lang.NullPointerException: Cannot read the array length becase "<local2>" is null
at org.springframework.content.commons.config.AnstractStoreBeanDefinitionRegistrar$IsCandidatePredicate.test(AnstractStoreBeanDefinitionRegistrar.java.359)
To Reproduce
Steps to reproduce the behavior:
- Add dependency -
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-mongo-boot-starter</artifactId>
<version>3.0.10</version>
</dependency>
- Add entity -
@Document("Sample")
@Getter
@Setter
public class Sample {
@Id
private String id;
@ContentId
private String contentId;
@ContentLength
private long contentLength;
}
- Add Repository -
public interface SampleContentStore extends MongoContentStore<Sample , String> {
}
@Repository
public interface SampleRepository extends CrudRepository<Sample , String > {
}
- Add Configuration -
@Configuration
@EnableMongoRepositories
@EnableMongoContentRepositories
public class MongoConfig extends AbstractMongoClientConfiguration {
@Autowired
private final MappingMongoConverter mongoConverter;
@Bean
public GridFsTemplate gridFsTemplate() {return new GridFsTemplate(mongoDbFactory(), mongoConverter);}
@Override
protected String getDatabaseName() {return "sample";}
}
Expected behavior
The service should be able to start without any errors.
paulcwarren commented
I was unable to reproduce this issue.
Can you modify to demonstrate?
paulcwarren commented
Closing due to inactivity. Please re-open if still an issue.