Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
This commit is contained in:
committed by
Sam Brannen
parent
48abd493fe
commit
afb8a0d1b1
@@ -362,11 +362,10 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
if (this.entityInterceptor instanceof Interceptor) {
|
||||
return (Interceptor) this.entityInterceptor;
|
||||
}
|
||||
else if (this.entityInterceptor instanceof String) {
|
||||
else if (this.entityInterceptor instanceof String beanName) {
|
||||
if (this.beanFactory == null) {
|
||||
throw new IllegalStateException("Cannot get entity interceptor via bean name if no bean factory set");
|
||||
}
|
||||
String beanName = (String) this.entityInterceptor;
|
||||
return this.beanFactory.getBean(beanName, Interceptor.class);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -344,8 +344,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
if (getEntityManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("'entityManagerFactory' or 'persistenceUnitName' is required");
|
||||
}
|
||||
if (getEntityManagerFactory() instanceof EntityManagerFactoryInfo) {
|
||||
EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) getEntityManagerFactory();
|
||||
if (getEntityManagerFactory() instanceof EntityManagerFactoryInfo emfInfo) {
|
||||
DataSource dataSource = emfInfo.getDataSource();
|
||||
if (dataSource != null) {
|
||||
setDataSource(dataSource);
|
||||
|
||||
Reference in New Issue
Block a user