1

I'm new to Spring. The goal is to learn Spring, to use Spring as a production application as it is industry standard.

The requirements of the app: Hibernate, Security, MVC, RESTful, DI, etc. The other Spring frameworks might be added in future. I'm reading "Spring in Action. Third Edition." by Craig Walls. He gave the examples how to use annotations, but anyway .xml is used. I'm wonder if I can write the application using only java classes to configure all modules in the application. I found Spring Boot gives ability to develop not using xml files. However I read the article http://steveperkins.com/use-spring-boot-next-project/ and author said Boot is not ready to be used for production applications. As far as I understood Boot hides all config work from me. Also my concern is that in future java-developers who knows Spring won't be able to deal with Spring Boot and I wouldn't find proper engineers for the project. Based upon this I have the following questions:

  • Is it possible to avoid using xml in Spring or better to mix xml files and annotations?
  • Is it easy for Spring developers to work with Spring Boot?
  • Am I able to learn Spring using Spring Boot?
  • Is Spring Boot is mature enough to use it in production?
PaintedRed
  • 1,398
  • 5
  • 19
  • 30

5 Answers5

5

Is it possible to avoid using xml in Spring or better to mix xml files and annotations?

Yes, it is. Spring now promotes Java configuration, and it's perfectly doable (I'm doing it) and even easy to only use Java to configure your Spring app. Even without using Boot.

Is it east for Spring developers to work with Spring Boot?

Why wouldn't it? It's well documented, and is based on Spring best practices.

Am I able to learn Spring using Spring Boot?

How could I answer that. Try doing it, and you'll see if you're able or not.

Is Spring Boot is mature enough to use it in production?

Yes, it is. The articleyou linked to is one year old. Spring developers have worked a lot on Boot since then. And Spring uses Boot internally to host their own spring.io web application. See https://github.com/spring-io/sagan

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
1

JB Nizet answered 3 answers very clearly. Just an addition about production readiness from my side. We are currently using Spring Boot for an application which we intend to move to production. There has not been any issue till now in prototyping and testing phase. It is very convenient and avoids boilerplate and gives production ready, standalone jar file with embedded server. You can also chose to build war file if you prefer.

"Am I able to learn Spring using Spring Boot?"

As you mentioned that you are new to Spring, it would probably be easier for you to pick up Spring Boot quickly.

To get started, if you are interested, following is the link to a webinar by Josh Long which gives you a really good insight of how easy it is to pick up Spring Boot: https://www.youtube.com/watch?v=eCos5VTtZoI

Yash
  • 85
  • 1
  • 10
0

I don't know much about Spring Boot but I know pretty much about spring. First of all you can use both annotations and xml configuration file/s in the same project. That is the most common way as far as I know.

There is also JavaConfig configuration option in which you don't use any xml files instead you use ordinary java class with @Configuration annotation. I didn't use and not saw much usage also.

cool
  • 1,746
  • 1
  • 14
  • 15
0

You can make a spring webapp without any xml, although spring security was ugly to configure last time I looked at that. For a webapp you need to implement WebApplicationInitializer, create an application context and register your @Configuration file(s) with the context. Then you register the dispatcher servlet and you're all set!

Lev Kuznetsov
  • 3,520
  • 5
  • 20
  • 33
0

I was nearly in the same boat four months ago when I started working on my web app & chose Spring as the platform after evaluating many choices. I also started with Spring in Action but got frustrated when the examples provided by the author didn't work (Spring basic MVC app not working). Since I was just starting, I was looking for some very basic but working examples. But unfortunately, most of the examples which came along with Spring text books, didn't work straight out of the box.

I would like to suggest few Spring resources which I found useful for starters:

Now, to answer your questions, although a bit differently:

  • Is it possible to avoid using xml in Spring or better to mix xml files and annotations

Now a days, you would find Annotations a lot in Spring code available on net/SO along with XML configuration. However, you can certainly avoid XML if you wish.

Is it easy for Spring developers to work with Spring Boot? Am I able to learn Spring using Spring Boot? Is Spring Boot is mature enough to use it in production?

My personal opinion would be to go with Spring Boot only if you believe it offers you certain advantages which are not possible to achieve otherwise. Remember, you may save time now but later on, it would be an additional dependency in your app and you may need to understand its architecture to debug it if things go wrong OR to enhance it as per your app requirements. Better to have minimal dependencies, my learning till now :)

Community
  • 1
  • 1
AAgg
  • 494
  • 1
  • 3
  • 19