Skip to content

Conversation

cachescrubber
Copy link
Contributor

Add possibility to configure a custom ExecutionContextSerializer in BatchAutoConfiguration

See #38234

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 11, 2023
@cachescrubber
Copy link
Contributor Author

I would like to auto configure a Jackson2ExecutionContextStringSerializer if enables by a use property.

	@Bean
	@ConditionalOnMissingBean(ExecutionContextSerializer.class)
	@ConditionalOnProperty(prefix = "spring.batch.jdbc", name = "use-jackson2-context-serializer", havingValue = "false")
	public Jackson2ExecutionContextStringSerializer executionContextStringSerializer() {
		return new Jackson2ExecutionContextStringSerializer();
	}

@fmbenhassine WDYT?

@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 13, 2023
@mhalbritter mhalbritter added this to the 3.3.x milestone Nov 13, 2023
# Conflicts:
#	spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java
#	spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java
@fmbenhassine
Copy link
Contributor

There is no need for a property, the presence of a bean of type ExecutionContextSerializer is enough to be picked up by Boot, otherwise a DefaultExecutionContextSerializer should be used. The last PR update LGTM.

@mhalbritter
Copy link
Contributor

Thank you very much!

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

Successfully merging this pull request may close these issues.

5 participants