paulcwarren/spring-content

Unable to use spring-content-mongo in springboot application

garvbhandari opened this issue · 2 comments

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:

  1. Add dependency -
<dependency>
<groupId>com.github.paulcwarren</groupId>
<artifactId>spring-content-mongo-boot-starter</artifactId>
<version>3.0.10</version>
</dependency>
  1. Add entity -
@Document("Sample")
@Getter
@Setter
public class Sample {
    @Id
    private String id;
    @ContentId
    private String contentId;
    @ContentLength
    private long contentLength;
}
  1. Add Repository -
public interface SampleContentStore extends MongoContentStore<Sample , String> {
}
@Repository
public interface SampleRepository extends CrudRepository<Sample , String > {
}
  1. 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.

I was unable to reproduce this issue.

Can you modify to demonstrate?

Closing due to inactivity. Please re-open if still an issue.