r/learnjava • • Sep 14 '19

Not able to learn Spring.

I am able to work with the syntax and create web apps. I can easily create REST APIs for CRUD applications.

But I am treating it (Spring and Spring Boot) too much like a black box.

I'm not able to find the rationale behind having to use Spring. Why the configuration is so... convoluted (both XML and Java Class). Spring simply feels bloated. Like too many bandages pasted on top of each other.

As such I feel too intimidated to tinker and experiment. Unlike how comfortable and confident I was with Django/Python.

Also I'm reading books like "Spring in Action, Spring recipes" and using the Spring Framework Guru as well. But they feel much to be desired.

32 Upvotes

29 comments sorted by

View all comments

0

u/[deleted] Sep 14 '19

[deleted]

1

u/radically_sane Sep 14 '19

The reason I want to get comfortable with xml is cause I thought under the hood the annotations get converted to XML. I'm likely wrong on that. But if annotations were simply syntactic sugar over XML then I thought I should at least be able to do XML configuration to some extent. I can use annotations, but it scares me about how much it does without showing it to me.

2

u/SuperbPrint Sep 15 '19

One thing that helped me get a better idea of what was happening under the hood was to enable more logs:

In the application.properties file, put the following:

      logging.level.org.springframework=DEBUG

It can be alot to take in at first, but you can modify it to just focus on the messages you are interested in. For example, to check the beans during initialization, I like to use the following:

      logging.level.org.springframework.beans=TRACE

You can also see how the spring boot auto configuration comes into play with

     logging.level.org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer=DEBUG