Skip to content

Allow override factory properties in user-defined configurer subclass #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

andreysaksonov
Copy link

@andreysaksonov andreysaksonov commented Mar 11, 2018

E.g. to set custom serializer. It was a pain to workaround https://jira.spring.io/browse/BATCH-2575 in spring-batch 3.x because neither factories nor dataSource/transactionManager are not exposed to subclass of default configurer - so the only solution is to create new implementation of BatchConfigurer and copy-paste most of the DefaultBatchConfigurer code there just to call one setter on factory.

@mminella mminella self-assigned this Apr 3, 2018
@mminella
Copy link
Member

mminella commented Apr 3, 2018

I think this takes the wrong approach. We really should enable sub classes better access to the DataSource and TransactionManager involved instead of exposing factory beans like this. There is a pull request that already does that in which we are currently looking at bringing in (in some form) for 4.1: #415

@mminella mminella closed this Apr 3, 2018
@andreysaksonov
Copy link
Author

andreysaksonov commented Apr 4, 2018

@mminella The idea was to use exposed methods first in subclass (super.createFooFactory) first, then apply additional configurations on the factory (call .setSomeProperty on factory), then DefaultConfigurer will use customized factories to create actual instance of repository/explorer. Exposure of transactionManager/dataSource will require to copy-paste again creation of factories/beans in subclass.
However, this PR is just simple solution aimed not to touch too many code. The high level issue is that there is only single configurer for everything, but you may want to customize only single bean and use defaults for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants