@@ -225,11 +225,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
225
225
jpaStorageSettings .setLastNEnabled (true );
226
226
}
227
227
228
- Integer inlineResourceThreshold = appProperties .getInline_resource_storage_below_size ();
229
- if (inlineResourceThreshold == null
230
- && appProperties .getBinary_storage_mode () == AppProperties .BinaryStorageMode .FILESYSTEM ) {
231
- inlineResourceThreshold = resolveFilesystemMinimumBinarySize (appProperties );
232
- }
228
+ Integer inlineResourceThreshold = resolveInlineResourceThreshold (appProperties );
233
229
if (inlineResourceThreshold != null && inlineResourceThreshold != 0 ) {
234
230
jpaStorageSettings .setInlineResourceTextBelowSize (inlineResourceThreshold );
235
231
}
@@ -352,35 +348,43 @@ public HibernatePropertiesProvider jpaStarterDialectProvider(
352
348
public IBinaryStorageSvc binaryStorageSvc (AppProperties appProperties ) {
353
349
IBinaryStorageSvc binaryStorageSvc ;
354
350
351
+ Integer maxBinarySize = appProperties .getMax_binary_size ();
352
+ Integer inlineResourceThreshold = resolveInlineResourceThreshold (appProperties );
353
+
355
354
if (appProperties .getBinary_storage_mode () == AppProperties .BinaryStorageMode .FILESYSTEM ) {
356
355
String baseDirectory = appProperties .getBinary_storage_filesystem_base_directory ();
357
356
Assert .hasText (
358
357
baseDirectory ,
359
358
"binary_storage_filesystem_base_directory must be provided when binary_storage_mode=FILESYSTEM" );
360
359
361
360
FilesystemBinaryStorageSvcImpl filesystemSvc = new FilesystemBinaryStorageSvcImpl (baseDirectory );
362
- int minimumBinarySize = resolveFilesystemMinimumBinarySize (appProperties );
361
+ int minimumBinarySize =
362
+ inlineResourceThreshold == null ? DEFAULT_FILESYSTEM_INLINE_THRESHOLD : inlineResourceThreshold ;
363
363
filesystemSvc .setMinimumBinarySize (minimumBinarySize );
364
364
365
- if (appProperties . getMax_binary_size () != null ) {
366
- filesystemSvc .setMaximumBinarySize (appProperties . getMax_binary_size () .longValue ());
365
+ if (maxBinarySize != null ) {
366
+ filesystemSvc .setMaximumBinarySize (maxBinarySize .longValue ());
367
367
}
368
368
369
369
binaryStorageSvc = filesystemSvc ;
370
370
} else {
371
371
DatabaseBinaryContentStorageSvcImpl databaseSvc = new DatabaseBinaryContentStorageSvcImpl ();
372
- if (appProperties . getMax_binary_size () != null ) {
373
- databaseSvc .setMaximumBinarySize (appProperties . getMax_binary_size ());
372
+ if (maxBinarySize != null ) {
373
+ databaseSvc .setMaximumBinarySize (maxBinarySize . longValue ());
374
374
}
375
375
binaryStorageSvc = databaseSvc ;
376
376
}
377
377
378
378
return binaryStorageSvc ;
379
379
}
380
380
381
- private int resolveFilesystemMinimumBinarySize (AppProperties appProperties ) {
382
- Integer inlineThreshold = appProperties .getInline_resource_storage_below_size ();
383
- return inlineThreshold == null ? DEFAULT_FILESYSTEM_INLINE_THRESHOLD : inlineThreshold ;
381
+ private Integer resolveInlineResourceThreshold (AppProperties appProperties ) {
382
+ Integer inlineResourceThreshold = appProperties .getInline_resource_storage_below_size ();
383
+ if (inlineResourceThreshold == null
384
+ && appProperties .getBinary_storage_mode () == AppProperties .BinaryStorageMode .FILESYSTEM ) {
385
+ return DEFAULT_FILESYSTEM_INLINE_THRESHOLD ;
386
+ }
387
+ return inlineResourceThreshold ;
384
388
}
385
389
386
390
@ Bean
0 commit comments