• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

The path to learning java spring

 
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, i've been getting back into doing java lately, and i've set my sites to the spring framework. I understand that there are multiple levels to this framework and I can't just jump in without knowing a few things.

I haven't done anything with server-side java. My skill level is probably around moderate, but I don't have much experience with things like jdbc and server side java in general. I have a decent understanding of relational databases, both ddl and using sql to query the database.

My question is, should I jump right into java servlets, or would it be more beneficial to start with something like beans. I guess the short of it is i'm not sure where to start here.

 
Marshal
Posts: 16631
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

I'd say you need to understand the concept of Dependency Injection first and foremost. That's what's at the core of Spring. From there, it's pretty much an open field since Spring has sprawled out to pretty much everything in the application stack. Focus on the parts that will be used to do most of your work. For me, that is web services and database stuff. For others, it may be batch processing and security. Just depends on what you want to use Spring for.
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Welcome to the Ranch!

I'd say you need to understand the concept of Dependency Injection first and foremost. That's what's at the core of Spring. From there, it's pretty much an open field since Spring has sprawled out to pretty much everything in the application stack. Focus on the parts that will be used to do most of your work. For me, that is web services and database stuff. For others, it may be batch processing and security. Just depends on what you want to use Spring for.



Alright, let me know if you have any pointers to resources on dependency injection.

I'm aiming to do server-side java programming.

Also thanks!
 
Junilu Lacar
Marshal
Posts: 16631
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would start with Googling for Dependency Injection with Spring
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Welcome to the Ranch!

I'd say you need to understand the concept of Dependency Injection first and foremost. That's what's at the core of Spring. From there, it's pretty much an open field since Spring has sprawled out to pretty much everything in the application stack. Focus on the parts that will be used to do most of your work. For me, that is web services and database stuff. For others, it may be batch processing and security. Just depends on what you want to use Spring for.



Hmmmm okay let me get this straight with dependency injection. It's essentially just avoiding the new operator and instead opting to pass an instance in through the constructor or through a method after initialization. I already do this p heavy with my projects, especially using mvc where i pass my controller in as a parameter to my views constructor.

With something like tihs


Also, how do i edit my comments, I know I made a mistake somewhere in this post lol.
 
Junilu Lacar
Marshal
Posts: 16631
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We've had problems in the past where users edited posts and rendered the thread or part of it nonsensical. So, we instituted a policy where users have to have a certain number of posts before they can edit their messages, the assumption being that after so many posts, they would be familiar with the norms and what types of edits are acceptable.

Edit: For example, this is the second time I have edited this reply, the first time to change "it's" to "its" in "One of its most..." below and the second time to add this comment.

As far as what you're doing, that's kind of ad hoc. Spring makes it much easier to manage all of that. One of its most used features is autowiring, where you just annotate fields that need DI and Spring will automatically instantiate and inject an appropriate bean instance for you.
 
Junilu Lacar
Marshal
Posts: 16631
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another thing about your example is that while you're using dependency injection for the View's dependency on your Controller, the Controller has a hard dependency on the View. And why would your View need to know about the Controller anyway?
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Another thing about your example is that while you're using dependency injection for the View's dependency on your Controller, the Controller has a hard dependency on the View. And why would your View need to know about the Controller anyway?



Ahh maybe that's kind of where I fall short understanding mvc. I'll go ahead and show the actual controller class used in the project i'm playing around with
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what's happening here is that when my button is clicked in my view class, it goes ahead and calls addIntervalThread with a new Interval, and an index in the ListModel that it should be in.

Hmm. Here is the github for this https://github.com/hsszyman/Intervallic

The relationship is between controller and view.

There are already a few things I know I need to move out of view. I guess where I'm getting stuck requiring the view being aware of the controller is in the button action listeners, and how to get information back and forth between the two.
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I believe one issue i'm running into is swing specific it seems. Swing itself apparently isn't very mvc friendly.
 
Junilu Lacar
Marshal
Posts: 16631
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hayden Szymanski wrote:So I believe one issue i'm running into is swing specific it seems. Swing itself apparently isn't very mvc friendly.



I had a look at your code on GitHub and it's a bit confusing. We shouldn't discuss that code in this thread because your original post was about learning Spring. If you have questions specifically about your code and Java Swing, then start a thread either in the Code Reviews forum or the Swing forum.
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahh alrighty, I'll go ahead and do that then
 
Hayden Szymanski
Greenhorn
Posts: 12
IntelliJ IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After I've figured out what needs to be improved with my personal code and done a bit more reading ( and applied practice ) with dependency injection I'm going to dive headfirst in some spring development to try and get some more specific questions. In hindsight a "where do i start" thread like this doesn't really do much when i should at least try to start something.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic