2

I'm new in Spring MVC. Mostly I'm learning by reading various blog and example. Most of the time I encounter wearied configuration error in XML files. Where no compile error. But during runtime not much useful error. Both XML and Java based configuration is new for me.

I think Java based configuration should produce more helpful compile and runtime error. I guess all configuration should be doable by Java config. I got few questions or suggestion to proceed learning Spring MVC.

  1. What is is never / latest XML or Java config ?

  2. Is doable completely by Java config or I have to mix up both Java and XML?

  3. Can I avoid XML completely?

  4. Which configuration is recommended?

  5. Does it has any performance difference?

  6. In case I have to use XML config, how to debug or trace XML config?

Thanks in advance. Hope you will answer in details.

masiboo
  • 4,537
  • 9
  • 75
  • 136
  • Hi, I'm not sure your question is a valid SO question because it's based on opinion. But I can share my opinion through a question and an answer I wrote: http://stackoverflow.com/q/24014919/2083523 (at the end of my answer there's a pros/cons section which I think can help you) And I can also refer you to my blog where I explained why I'm so supportive of `@Configuration` class and not XML files: http://avietzioni.blogspot.co.il/2014/05/so-long-spring-xmls-configuration-class.html – Avi Nov 15 '14 at 12:31

1 Answers1

1

What is is never / latest XML or Java config ?

Java config is newer

Is doable completely by Java config or I have to mix up both Java and XML?

Can I avoid XML completely?

You can avoid using XML in latest versions of spring (i.e. 4 and later)

Which configuration is recommended?

Seems Spring Source promotes Java Configuration

Does it has any performance difference?

Startup time is not important for performance. Runtime performance is same.

In case I have to use XML config, how to debug or trace XML config?

In case of error in XML you will get exception with stacktrace. In most of cases it is enough.

Community
  • 1
  • 1
Denis Borovikov
  • 737
  • 5
  • 9