java - Is it recommended to use the Spring's predefined InitializingBean and DisposableBean callbacks or not? -


is recommended use spring's predefined initializingbean , disposablebean callbacks or own init-method , destroy-method initialization , cleanup.

i started learning spring framework , confused follwing statements that,

  1. it recommended do not use initializingbean or disposablebean callbacks, because xml configuration gives flexibility in terms of naming method. (from tutorial blog)

  2. it recommended use spring's predefined initializingbean or disposablebean callbacks. (from tutor)

are both valid based on scenario?

the first 1 doesn't force class implement spring-proprietary interface, recommends using xml configure beans. xml is, quite frankly, awful, , spring has provided java configurations or simple annotations long time, allows removing need verbose, cumbersome, unsafe xml configuration.

i use standard postconstruct , predestroy annotations this.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -