Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to validate spring applicationContext.xml file

Tags:

java

spring

I have couple of beans defined in the applicationContext.xml file and found if I made mistake(say typo) with the bean's name, spring won't complain anything and go ahead load the invalidate configuration. doesn't spring do the checking automatically? and how can i implement schema validation on the applicationContext.xml file? thanks.

like image 436
ohana Avatar asked Feb 25 '23 15:02

ohana


1 Answers

IntelliJ IDEA has a wonderful support for Spring, including:

  • detecting broken references (bean does not exist, has a wrong type, etc.)
  • completing bean names when Ctrl+Space is pressed (along with narrowing the list to only the beans matching by type)
  • discovering missing/duplicated beans when @Resource/@Autowired is used and it will fail to autowire at runtime
  • quick navigation between Java and application context XML
  • ...and lots more

Also I strongly recommend writing Spring smoke integration test. It doesn't have to test anything, just context startup (you would be amazed, how many errors it discovers).

like image 139
Tomasz Nurkiewicz Avatar answered Mar 08 '23 11:03

Tomasz Nurkiewicz