Skip to content

Conversation

@kdlan
Copy link

@kdlan kdlan commented Nov 15, 2018

If the application use multiple DataSources for different domain classes, Spring Data JDBC does support it directly
with @EnableJdbcRepositories add a property jdbcOperationsRef in order to support this.

@pivotal-issuemaster
Copy link

@kdlan Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@kdlan Thank you for signing the Contributor License Agreement!

@kdlan kdlan force-pushed the 1.0.x branch 3 times, most recently from b20ccf0 to 900f910 Compare November 30, 2018 06:16
Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this seems to break backward compatibility in cases where a unique NamedParameterJdbcOperations bean is present but has a different name.

We need a backward compatible to do this.

Also, please add @author tags to the files changed with your name written in latin letters.

@kdlan
Copy link
Author

kdlan commented Dec 13, 2018

@schauder

Reference to determineAutowireCandidate, for backward compatible JdbcRepositoryConfigExtension should be implemented as following

  • if jdbcOperationsRef has text, use it as field reference bean name
  • if jdbcOperationsRef has no text, for bean names of class NamedParameterJdbcOperations:
    • if only one bean name, use it as field reference bean name
    • if multiple bean names
      • determine primary bean name
      • determine highest priority bean name
      • determine bean name equals field name jdbcOperations
      • throw NoUniqueBeanDefinitionException
    • if no bean names throw NoSuchBeanDefinitionException

Is that ok?

@schauder
Copy link
Contributor

That sounds correct.

@kdlan
Copy link
Author

kdlan commented Dec 14, 2018

Make a new commit for backward compatible.

Reference to OrderUtils, the priority of bean definetion depends on javax.annotation.Priority and this is not used in project now. So I did not implement the determine highest priority bean.

schauder added a commit that referenced this pull request Dec 17, 2018
schauder added a commit that referenced this pull request Dec 17, 2018
Removed most usage of the Stream API. Improved error messages. Added tests. Code formatting. Original pull request: #102.
@schauder
Copy link
Contributor

That's polished and merged. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants