diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java
index 4dde8ea152..eeb61b34da 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@ private Collection<Job> doLoad(ApplicationContextFactory factory, boolean unregi
 
 			if (!autoRegistrationDetected) {
 
-				Job job = (Job) context.getBean(name);
+				Job job = context.getBean(name, Job.class);
 				String jobName = job.getName();
 
 				// On reload try to unregister first
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java
index 7f250d389c..d1b742810e 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -119,19 +119,19 @@ private Object injectDefaults(Object bean) {
 			JobParserJobFactoryBean fb = (JobParserJobFactoryBean) bean;
 			JobRepository jobRepository = fb.getJobRepository();
 			if (jobRepository == null) {
-				fb.setJobRepository((JobRepository) applicationContext.getBean(DEFAULT_JOB_REPOSITORY_NAME));
+				fb.setJobRepository(applicationContext.getBean(DEFAULT_JOB_REPOSITORY_NAME, JobRepository.class));
 			}
 		}
 		else if (bean instanceof StepParserStepFactoryBean) {
 			StepParserStepFactoryBean<?, ?> fb = (StepParserStepFactoryBean<?, ?>) bean;
 			JobRepository jobRepository = fb.getJobRepository();
 			if (jobRepository == null) {
-				fb.setJobRepository((JobRepository) applicationContext.getBean(DEFAULT_JOB_REPOSITORY_NAME));
+				fb.setJobRepository(applicationContext.getBean(DEFAULT_JOB_REPOSITORY_NAME, JobRepository.class));
 			}
 			PlatformTransactionManager transactionManager = fb.getTransactionManager();
 			if (transactionManager == null && fb.requiresTransactionManager()) {
 				fb.setTransactionManager(
-						(PlatformTransactionManager) applicationContext.getBean(DEFAULT_TRANSACTION_MANAGER_NAME));
+						applicationContext.getBean(DEFAULT_TRANSACTION_MANAGER_NAME, PlatformTransactionManager.class));
 			}
 		}
 		return bean;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
index e03512d707..723baabf36 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -356,7 +356,7 @@ int start(String jobPath, String jobIdentifier, String[] parameters, Set<String>
 				}
 			}
 			if (job == null) {
-				job = (Job) context.getBean(jobName);
+				job = context.getBean(jobName, Job.class);
 			}
 
 			if (opts.contains("-next")) {
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/SpringBeanJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/SpringBeanJobTests.java
index c47fd72c0c..a4a38c2c2a 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/SpringBeanJobTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/SpringBeanJobTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2022 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ void testBeanNameWithBeanDefinition() {
 		context.registerBeanDefinition("bean", new RootBeanDefinition(JobSupport.class, args, null));
 
 		context.refresh();
-		JobSupport configuration = (JobSupport) context.getBean("bean");
+		JobSupport configuration = context.getBean("bean", JobSupport.class);
 		assertNotNull(configuration.getName());
 		assertEquals("foo", configuration.getName());
 		configuration.setBeanName("bar");
@@ -66,7 +66,7 @@ void testBeanNameWithParentBeanDefinition() {
 		context.registerBeanDefinition("parent", new RootBeanDefinition(JobSupport.class, args, null));
 		context.registerBeanDefinition("bean", new ChildBeanDefinition("parent"));
 		context.refresh();
-		JobSupport configuration = (JobSupport) context.getBean("bean");
+		JobSupport configuration = context.getBean("bean", JobSupport.class);
 		assertNotNull(configuration.getName());
 		assertEquals("bar", configuration.getName());
 		configuration.setBeanName("foo");
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java
index af0b5fc1a6..b2820ad838 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ void testXmlJobScopeWithInheritance() throws Exception {
 		context = new ClassPathXmlApplicationContext(
 				"org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTestsInheritance-context.xml");
 		JobSynchronizationManager.register(jobExecution);
-		SimpleHolder value = (SimpleHolder) context.getBean("child");
+		SimpleHolder value = context.getBean("child", SimpleHolder.class);
 		assertEquals("JOB", value.call());
 	}
 
@@ -97,9 +97,9 @@ void testJobScopeWithProxyTargetClass() throws Exception {
 	void testStepScopeXmlImportUsingNamespace() throws Exception {
 		init(JobScopeConfigurationXmlImportUsingNamespace.class);
 
-		SimpleHolder value = (SimpleHolder) context.getBean("xmlValue");
+		SimpleHolder value = context.getBean("xmlValue", SimpleHolder.class);
 		assertEquals("JOB", value.call());
-		value = (SimpleHolder) context.getBean("javaValue");
+		value = context.getBean("javaValue", SimpleHolder.class);
 		assertEquals("JOB", value.call());
 	}
 
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java
index 5774e00314..e3b7cd1cfc 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ void testXmlStepScopeWithInheritance() throws Exception {
 		context = new ClassPathXmlApplicationContext(
 				"org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTestsInheritance-context.xml");
 		StepSynchronizationManager.register(stepExecution);
-		SimpleHolder value = (SimpleHolder) context.getBean("child");
+		SimpleHolder value = context.getBean("child", SimpleHolder.class);
 		assertEquals("STEP", value.call());
 	}
 
@@ -96,9 +96,9 @@ void testStepScopeWithProxyTargetClass() throws Exception {
 	void testStepScopeXmlImportUsingNamespace() throws Exception {
 		init(StepScopeConfigurationXmlImportUsingNamespace.class);
 
-		SimpleHolder value = (SimpleHolder) context.getBean("xmlValue");
+		SimpleHolder value = context.getBean("xmlValue", SimpleHolder.class);
 		assertEquals("STEP", value.call());
-		value = (SimpleHolder) context.getBean("javaValue");
+		value = context.getBean("javaValue", SimpleHolder.class);
 		assertEquals("STEP", value.call());
 	}
 
@@ -109,9 +109,9 @@ void testStepScopeXmlImportUsingNamespace() throws Exception {
 	public void testStepScopeUsingNamespaceAutoregisterBeans() throws Exception {
 		init(StepScopeConfigurationTestsUsingNamespaceAutoregisterBeans.class);
 
-		ISimpleHolder value = (ISimpleHolder) context.getBean("xmlValue");
+		ISimpleHolder value = context.getBean("xmlValue", ISimpleHolder.class);
 		assertEquals("STEP", value.call());
-		value = (ISimpleHolder) context.getBean("javaValue");
+		value = context.getBean("javaValue", ISimpleHolder.class);
 		assertEquals("STEP", value.call());
 	}
 
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java
index 263a59b701..2ec16c9a34 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -145,7 +145,7 @@ void testNestedPartitionStepStepReference() throws Throwable {
 			String stepExecutionName = se.getStepName();
 			// the partitioned step
 			if (stepExecutionName.equalsIgnoreCase("j3s1")) {
-				PartitionStep partitionStep = (PartitionStep) this.applicationContext.getBean(stepExecutionName);
+				PartitionStep partitionStep = this.applicationContext.getBean(stepExecutionName, PartitionStep.class);
 				// prove that the reference in the {@link
 				// TaskExecutorPartitionHandler} is the step configured inline
 				TaskExecutorPartitionHandler taskExecutorPartitionHandler = accessPrivateField(partitionStep,
@@ -184,7 +184,7 @@ void testNestedPartitionStep() throws Throwable {
 			String stepExecutionName = se.getStepName();
 			if (stepExecutionName.equalsIgnoreCase("j4s1")) { // the partitioned
 				// step
-				PartitionStep partitionStep = (PartitionStep) this.applicationContext.getBean(stepExecutionName);
+				PartitionStep partitionStep = this.applicationContext.getBean(stepExecutionName, PartitionStep.class);
 
 				// prove that the reference in the {@link
 				// TaskExecutorPartitionHandler} is the step configured inline
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
index caf6f2f99c..dc94c639b9 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ class StepListenerInStepParserTests {
 
 	@Test
 	void testListenersAtStepLevel() throws Exception {
-		Step step = (Step) beanFactory.getBean("s1");
+		Step step = beanFactory.getBean("s1", Step.class);
 		List<?> list = getListeners(step);
 		assertEquals(1, list.size());
 		assertTrue(list.get(0) instanceof DummyStepExecutionListener);
@@ -54,7 +54,7 @@ void testListenersAtStepLevel() throws Exception {
 	@Test
 	// TODO: BATCH-1689 (expected=BeanCreationException.class)
 	void testListenersAtStepLevelWrongType() throws Exception {
-		Step step = (Step) beanFactory.getBean("s2");
+		Step step = beanFactory.getBean("s2", Step.class);
 		List<?> list = getListeners(step);
 		assertEquals(1, list.size());
 		assertTrue(list.get(0) instanceof DummyChunkListener);
@@ -62,7 +62,7 @@ void testListenersAtStepLevelWrongType() throws Exception {
 
 	@Test
 	void testListenersAtTaskletAndStepLevels() throws Exception {
-		Step step = (Step) beanFactory.getBean("s3");
+		Step step = beanFactory.getBean("s3", Step.class);
 		List<?> list = getListeners(step);
 		assertEquals(2, list.size());
 		assertTrue(list.get(0) instanceof DummyStepExecutionListener);
@@ -71,7 +71,7 @@ void testListenersAtTaskletAndStepLevels() throws Exception {
 
 	@Test
 	void testListenersAtChunkAndStepLevels() throws Exception {
-		Step step = (Step) beanFactory.getBean("s4");
+		Step step = beanFactory.getBean("s4", Step.class);
 		List<?> list = getListeners(step);
 		assertEquals(2, list.size());
 		assertTrue(list.get(0) instanceof DummyStepExecutionListener);
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java
index 6932f31c12..a482c3022a 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepNameTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2022 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ void testStepNames(Resource resource) throws Exception {
 		for (String name : stepLocators.keySet()) {
 			StepLocator stepLocator = stepLocators.get(name);
 			Collection<String> stepNames = stepLocator.getStepNames();
-			Job job = (Job) context.getBean(name);
+			Job job = context.getBean(name, Job.class);
 			String jobName = job.getName();
 			assertFalse(stepNames.isEmpty(), "Job has no steps: " + jobName);
 			for (String registeredName : stepNames) {
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
index 7d709d6ef8..3521996c5a 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
@@ -96,7 +96,7 @@ void testStepParserBeanName() {
 				"org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml");
 		Map<String, Step> beans = ctx.getBeansOfType(Step.class);
 		assertTrue(beans.containsKey("s1"), "'s1' bean not found");
-		Step s1 = (Step) ctx.getBean("s1");
+		Step s1 = ctx.getBean("s1", Step.class);
 		assertEquals("s1", s1.getName(), "wrong name");
 	}
 
@@ -112,7 +112,7 @@ void testStepParserCommitInterval() throws Exception {
 				"org/springframework/batch/core/configuration/xml/StepParserCommitIntervalTests-context.xml");
 		Map<String, Step> beans = ctx.getBeansOfType(Step.class);
 		assertTrue(beans.containsKey("s1"), "'s1' bean not found");
-		Step s1 = (Step) ctx.getBean("s1");
+		Step s1 = ctx.getBean("s1", Step.class);
 		CompletionPolicy completionPolicy = getCompletionPolicy(s1);
 		assertTrue(completionPolicy instanceof SimpleCompletionPolicy);
 		assertEquals(25, ReflectionTestUtils.getField(completionPolicy, "chunkSize"));
@@ -124,7 +124,7 @@ void testStepParserCompletionPolicy() throws Exception {
 				"org/springframework/batch/core/configuration/xml/StepParserCompletionPolicyTests-context.xml");
 		Map<String, Step> beans = ctx.getBeansOfType(Step.class);
 		assertTrue(beans.containsKey("s1"), "'s1' bean not found");
-		Step s1 = (Step) ctx.getBean("s1");
+		Step s1 = ctx.getBean("s1", Step.class);
 		CompletionPolicy completionPolicy = getCompletionPolicy(s1);
 		assertTrue(completionPolicy instanceof DummyCompletionPolicy);
 	}
@@ -210,7 +210,7 @@ private void validateTransactionAttributesInherited(String stepName, Application
 	@SuppressWarnings("unchecked")
 	private List<StepExecutionListener> getListeners(String stepName, ApplicationContext ctx) throws Exception {
 		assertTrue(ctx.containsBean(stepName));
-		Step step = (Step) ctx.getBean(stepName);
+		Step step = ctx.getBean(stepName, Step.class);
 		assertTrue(step instanceof TaskletStep);
 		Object compositeListener = ReflectionTestUtils.getField(step, "stepExecutionListener");
 		Object composite = ReflectionTestUtils.getField(compositeListener, "list");
@@ -234,7 +234,7 @@ private StepExecutionListener getListener(String stepName, ApplicationContext ct
 
 	private DefaultTransactionAttribute getTransactionAttribute(ApplicationContext ctx, String stepName) {
 		assertTrue(ctx.containsBean(stepName));
-		Step step = (Step) ctx.getBean(stepName);
+		Step step = ctx.getBean(stepName, Step.class);
 		assertTrue(step instanceof TaskletStep);
 		Object transactionAttribute = ReflectionTestUtils.getField(step, "transactionAttribute");
 		return (DefaultTransactionAttribute) transactionAttribute;
@@ -250,7 +250,7 @@ void testInheritFromBean() {
 
 	private Tasklet getTasklet(String stepName, ApplicationContext ctx) {
 		assertTrue(ctx.containsBean(stepName));
-		Step step = (Step) ctx.getBean(stepName);
+		Step step = ctx.getBean(stepName, Step.class);
 		assertTrue(step instanceof TaskletStep);
 		Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
 		assertTrue(tasklet instanceof Tasklet);
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTests.java
index 11823defd7..c7403e702c 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TaskletStepAllowStartIfCompleteTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2022 the original author or authors.
+ * Copyright 2013-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ class TaskletStepAllowStartIfCompleteTests {
 	@Test
 	void test() throws Exception {
 		// retrieve the step from the context and see that it's allow is set
-		AbstractStep abstractStep = (AbstractStep) context.getBean("simpleJob.step1");
+		AbstractStep abstractStep = context.getBean("simpleJob.step1", AbstractStep.class);
 		assertTrue(abstractStep.isAllowStartIfComplete());
 	}
 
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java
index f4651a2479..daf2012f74 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDaoTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2023 the original author or authors.
+ * Copyright 2008-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,14 +31,14 @@ class JdbcStepExecutionDaoTests extends AbstractStepExecutionDaoTests {
 
 	@Override
 	protected StepExecutionDao getStepExecutionDao() {
-		return (StepExecutionDao) applicationContext.getBean("stepExecutionDao");
+		return applicationContext.getBean("stepExecutionDao", StepExecutionDao.class);
 	}
 
 	@Override
 	protected JobRepository getJobRepository() {
 		deleteFromTables("BATCH_JOB_EXECUTION_CONTEXT", "BATCH_STEP_EXECUTION_CONTEXT", "BATCH_STEP_EXECUTION",
 				"BATCH_JOB_EXECUTION_PARAMS", "BATCH_JOB_EXECUTION", "BATCH_JOB_INSTANCE");
-		return (JobRepository) applicationContext.getBean("jobRepository");
+		return applicationContext.getBean("jobRepository", JobRepository.class);
 	}
 
 	/**
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java
index ec486a7636..7b9640d16b 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -339,7 +339,7 @@ private StepExecution launchStep(String stepName) throws Exception {
 		job.setJobRepository(jobRepository);
 
 		List<Step> stepsToExecute = new ArrayList<>();
-		stepsToExecute.add((Step) applicationContext.getBean(stepName));
+		stepsToExecute.add(applicationContext.getBean(stepName, Step.class));
 		job.setSteps(stepsToExecute);
 
 		JobExecution jobExecution = jobLauncher.run(job,
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java
index 43b9ff289e..cd2b0de1a3 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/AbstractDatabaseItemStreamItemReaderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009-2023 the original author or authors.
+ * Copyright 2009-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ void testReadToExhaustion() throws Exception {
 	}
 
 	protected DataSource getDataSource() {
-		return (DataSource) ctx.getBean("dataSource");
+		return ctx.getBean("dataSource", DataSource.class);
 	}
 
 }
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcBatchItemWriterBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcBatchItemWriterBuilderTests.java
index cdc7c5fc76..76ffb25b76 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcBatchItemWriterBuilderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcBatchItemWriterBuilderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ class JdbcBatchItemWriterBuilderTests {
 	@BeforeEach
 	void setUp() {
 		this.context = new AnnotationConfigApplicationContext(TestDataSourceConfiguration.class);
-		this.dataSource = (DataSource) context.getBean("dataSource");
+		this.dataSource = context.getBean("dataSource", DataSource.class);
 	}
 
 	@AfterEach
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilderTests.java
index 16e33c6107..fa66612886 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ class JdbcCursorItemReaderBuilderTests {
 	@BeforeEach
 	void setUp() {
 		this.context = new AnnotationConfigApplicationContext(TestDataSourceConfiguration.class);
-		this.dataSource = (DataSource) context.getBean("dataSource");
+		this.dataSource = context.getBean("dataSource", DataSource.class);
 	}
 
 	@AfterEach
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcPagingItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcPagingItemReaderBuilderTests.java
index a6220cbeb1..850067929d 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcPagingItemReaderBuilderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcPagingItemReaderBuilderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ class JdbcPagingItemReaderBuilderTests {
 	@BeforeEach
 	void setUp() {
 		this.context = new AnnotationConfigApplicationContext(TestDataSourceConfiguration.class);
-		this.dataSource = (DataSource) context.getBean("dataSource");
+		this.dataSource = context.getBean("dataSource", DataSource.class);
 	}
 
 	@AfterEach
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaCursorItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaCursorItemReaderBuilderTests.java
index d24fca1a7a..1affc62d81 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaCursorItemReaderBuilderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaCursorItemReaderBuilderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ class JpaCursorItemReaderBuilderTests {
 	void setUp() {
 		this.context = new AnnotationConfigApplicationContext(
 				JpaCursorItemReaderBuilderTests.TestDataSourceConfiguration.class);
-		this.entityManagerFactory = (EntityManagerFactory) context.getBean("entityManagerFactory");
+		this.entityManagerFactory = context.getBean("entityManagerFactory", EntityManagerFactory.class);
 	}
 
 	@AfterEach
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java
index 8fce0376be..e0f1f67e04 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JpaPagingItemReaderBuilderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ class JpaPagingItemReaderBuilderTests {
 	void setUp() {
 		this.context = new AnnotationConfigApplicationContext(
 				JpaPagingItemReaderBuilderTests.TestDataSourceConfiguration.class);
-		this.entityManagerFactory = (EntityManagerFactory) context.getBean("entityManagerFactory");
+		this.entityManagerFactory = context.getBean("entityManagerFactory", EntityManagerFactory.class);
 	}
 
 	@AfterEach
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java
index bded5597a9..365ce8a5ed 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/jms/SynchronousTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2023 the original author or authors.
+ * Copyright 2006-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -155,7 +155,7 @@ void JpaNativeQueryProviderIntegrationTeststestPartialRollback() {
 		// The JmsTemplate is used elsewhere outside a transaction, so
 		// we need to use one here that is transaction aware.
 		final JmsTemplate txJmsTemplate = new JmsTemplate(
-				(ConnectionFactory) applicationContext.getBean("txAwareConnectionFactory"));
+				applicationContext.getBean("txAwareConnectionFactory", ConnectionFactory.class));
 		txJmsTemplate.setReceiveTimeout(100L);
 		txJmsTemplate.setSessionTransacted(true);
 
diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java
index e16e1410a7..a52cfd7620 100755
--- a/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java
+++ b/spring-batch-test/src/test/java/org/springframework/batch/test/SampleStepTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2022 the original author or authors.
+ * Copyright 2008-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ void tearDown() {
 
 	@Test
 	void testTasklet() {
-		Step step = (Step) context.getBean("s2");
+		Step step = context.getBean("s2", Step.class);
 		assertEquals(BatchStatus.COMPLETED, stepRunner.launchStep(step).getStatus());
 		assertEquals(2, jdbcTemplate.queryForObject("SELECT ID from TESTS where NAME = 'SampleTasklet2'", Integer.class)
 			.intValue());