• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why spring uses XML file format for configuration

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there !

Why SPRING uses the

XML File format for all the configuration ?

and not using other file formats ? say like.. configuring in the PROPERTIES file
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guru Vijay wrote:Hi there !

Why SPRING uses the

XML File format for all the configuration ?

and not using other file formats ? say like.. configuring in the PROPERTIES file



There is more than just xml. There are annotations and Java Config. And you can load information from .properties files, but still within xml. And there is also a way to use JSON. JSON would require a bit of Google searching, but for example Grails does Spring configuration with JSON.

Mark
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to add couple of points
For the large and complex applications readability of the context is very important,
Readability (Parent/Child Nodes) of the complex XML content is very much easier compare to property files.
Property files/Text-based files/JSON is good for the exchanging the data.
XML SCHEA includes proper data types compared to text-based files.
XML has some performance overhead while processing/exchanging the data but in my opinion if you drill down to more details XML has more advantages compare to text-based files
 
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would post the question why not XML? What is wrong with XML - that spring should not use XML?
XML is traditionally used in wire-strapping most application frameworks and with good reason!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd want to amend Sam's post: XML isn't bad for structured config data in frameworks that date from before Java 5 and its annotations. These days there's a strong tendency to move away from XML in frameworks such as Hibernate, JPA, Stripes, and -yes- Spring :-)
 
Saifuddin Merchant
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:I'd want to amend Sam's post: XML isn't bad for structured config data in frameworks that date from before Java 5 and its annotations. These days there's a strong tendency to move away from XML in frameworks such as Hibernate, JPA, Stripes, and -yes- Spring :-)



I think it's still a personal preference. I like XML over annotations. (actually a mix of xml and annotations!)

e.g. I prefer to put @Autowired and @Transactional in code. I prefer to have my bean definitions in XML ....
 
reply
    Bookmark Topic Watch Topic
  • New Topic