paulcwarren / spring-content

Cloud-Native Storage and Enterprise Content Services (ECMS) for Spring
https://paulcwarren.github.io/spring-content/
Apache License 2.0
259 stars 63 forks source link

Unable to use spring-content-mongo in springboot application #1999

Open garvbhandari opened 1 week ago

garvbhandari commented 1 week ago

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>
  2. 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 > {
    }
  2. 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 1 week ago

I was unable to reproduce this issue.

Can you modify to demonstrate?