我有一个spring boot应用程序,我通过属性文件配置了大多数属性。但是,我在寻找是否有办法通过Spring引导属性设置TRANSACTION_ISOLATION_LEVEL。有人可以帮我这个。
我正在以下列方式初始化数据源bean:
class Program
{
static void Main(string[] args)
{
try
{
using (var fi = new FileHandler())
{
//open the file
fi.Open();
//write to the file
fi.Write();
//excption occurs
throw new Exception("Inside using block");
fi.Close();
}
}
catch (Exception e)
{
//now I only have the exception from the dispose but not the exception that occured in the using block itself
//I know I could wrap the code inside the using in a try/catch itself, just asking if it is possible without 2 try/catches
}
}
}
public class FileHandler : IDisposable
{
public void Dispose()
{
//Close the file
//for some reason it fails with an exception
throw new Exception("Inside dispose");
}
}
有人可以帮助我了解如何通过属性或在数据源初始化期间指定TRANSACTION_ISOLATION_LEVEL。