Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-2338

Unable to specialise MongoRepositoryFactoryBean due to final method

    XMLWordPrintable

    Details

      Description

      In a microservice-based application I use JPA and MongoDb.

      I need to specialise the RepositoryFactoryBean classes to add my own RepositoryProxyPostProcessor.

      To achieve this, I use the following annotations:

      • @EnableJpaRepositories(repositoryFactoryBeanClass = MyJpaRepositoryFactoryBean.class)
      • @EnableMongoRepositories(repositoryFactoryBeanClass=MyMongoRepositoryFactoryBean.class)

      I succeeded with JPA overwriting the JpaRepositoryFactoryBean.createRepositoryFactory() method.

      I fail with Mongo as the MongoRepositoryFactoryBean.createRepositoryFactory() method is declared as final. The only way to do it is to completely rewrite the RepositoryFactoryBeanSupport.afterPropertiesSet() method.

      I think it should not be final to authorize easy customization. I suggest this small change.

      Could MongoRepositoryFactoryBean.createRepositoryFactory final keyword be removed ?

      Thanks,

      Ben.

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            Benoit Besson Benoit Besson
            Last updater:
            Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: