Xin tài liệu về framework Spring của Java

Tuy trên mạng rất nhiều nhưng với newbie sẽ rất là rối vì phải vật lộn giữa 1 đống tài liệu mà không biết cái nào là trọng tâm, cũng như một số bí kíp đòi hỏi nội công cao cường mới luyện được nếu ko sẽ tẩu hỏa nhập ma :sweat_smile:, vì vậy mong cao thủ nào đã từng luyện qua bộ môn này rồi cho tại hạ được xin bí kíp (sách, web, video, tut, examples, v.v).

Cảm ơn mọi người đã đọc :heart_eyes:

2 Likes

Minh thay trên tutorialspoint hướng dẫn cũng chi tiết lắm mà.
Spring thì có mấy cái chính là:
Spring Bean
Spring DI (dependency injection)
Speing AOP
Spring MVC

1 Like

cái framework spring này nó rất rộng…học không vẫn chưa thấy được cái hay của nó phải bắt tay vào làm 1 dự án tầm trung mới thấy đc …mình đã làm 1 bài tập lớn về spring framework nhưng vẫn chỉ dừng ở mức biết sử dụng thôi …ai học java thì nên học qua spring…

1 Like

I’m working with Spring now. Before that I asked @Voodoo and some others a same question but on congdongjava.com.

If you need i will give you what i received. You just only need manage 3 things and all after that maybe easy for you

  • Java bean - here is a my post about java bean
  • Spring DI
  • IOC

In fact, the core of Spring is IoC (Inversion of Control) and DI
(dependency injection). So if you know clearly OOP and the
characteristics of interface, it is easy for studying Spring - according
to my experience .

on the side of ebook, i want to recommend you “Spring in pratice” - a good book for Spring.

with Spring Framework, we can imagine so that:

  • in the normal, when we want have an instance, we must to initialize
    an object by calling the keyword “new”, right ? and we want to use this
    instance anywhere in the application ? what should we do ? we create a
    global variable, right ? so we must to manage it (create, call, destroy)

  • and now, instead of us who manage the objects like that, Spring will
    do it. All you need to do is declare the object that you want. Enough
    !!!

For ex: No Spring and with Spring

*No Spring:

  • i have class DBConnection - responsible for creating connection and manipulating with DB

  • i want to insert a Customer, i have to new DBConnection, right ? and call function executeQuery(String sql), right ?

  • now, i want to insert a Product, i have to new DBConnection and call function executeQuery(String sql), not news

  • i will do that for actions CRUD. it’s so tedious when we have to initialize this object in many time of use

*With Spring:

  • i have to declare object DBConnection with id=“dbConnect”,

  • if i want to insert a Customer, i will tell with Spring: “hey
    brother, give instance with id = dbConnect”. Spring will find and
    respond to your demand: " here, take it and use it, just use it, without
    initialize it, and don’t worry after, i will manage it". Immediately, i
    have the instance of DBConnection and just call function
    executeQuery(…

  • and i want to insert a Product. no news, i demand Spring “hey guy, i
    want to the instance with id = dbConnect”. Like that, i have
    immediately this instance and calling function. But 2 instance is the
    same.

Every time i want to use this instance, i just tell to Spring and i have
it. i don’t need to manage it (init, call, destroy), Spring will do
that.

So,

when Spring init and call instance for giving me, it is IoC - inversion
of control because in the normal, instead of you who have to init it,
Spring will find that

when Spring give me the instance, it is DI - dependency injection - implemention IoC

I will have 2 posts about DI and IOC as soon as posible

6 Likes

Have knowledge on a technique(Spring/Strut) is easy and unstable, have knowledge on a technology(Java) is hard and solid.
All of techniques in Spring are based on Java. If you have enough knowledge and vast of hour practicing Java, you can easily create a simple “Spring” for yourself. I have created a simple client-side framework based on Netty(it is reliable on traffic handling), and I can do whatever I want with it, beside that Spring configuration is really a pain in the @ss when first use.
And two most techniques you have to learn in Java: Reflection and Annotation if you want to create it for yourself. Oh, and nearly 5 thousands of hours of practicing. Don’t worry about such amount of time, when you have enough experience, you will feel like a God, who can create anything, and it is so damn satisfied.

On another hand, when the first time I applied for a job, Spring framework is on the list of requirement knowledge. Four years ago, and today it’s the same. But guess what? Be less such Java Spring/Struts/Hibernate jobs, but more on Big Data/Hadoop/Map Reduce jobs. It’s the beginning of digital era, Spring will go back on the stage, have a job with Spring will be harder and harder, till a lot of students will learn Spring like you, and a lot more of experience Developers who practicing Spring with a huge amount of time.

So, why don’t live on a solid ground than an unstable one?

4 Likes

thanks you so much.it is easy to understand.I am looking forward to reading about DI and IOC.

2 Likes

Could you explain what’s difference between IoC & DI? As my knowledge, DI is implementation of IoC :blush:

2 Likes

Maybe my knowledge still not enough. But i think it’s right!

Yes, I’m absolutely agree with you. Almost all of students in VN are chasing trends. Instead of hard working with base language, we learn how to use framework which make we have a job or make money faster. But it make we become a worker like farmer not computer science. So, we can not go far (I realized that since I have work)

I will tell you all about IOC and DI which my teacher teachs me and some things i have realized in my next post.

1 Like

Thanks for your comment. I will read it carefully and try to learn Spring. If i have some problem, hope you will help :smiley:

2 Likes

When you deploy(production) or run(local) a Spring project, its core will automatically look up all the configuration(xml) or annotation(Java) and process base on the xml or Annotation. Such as with @Injected annotation, it will create an pooled object associate with the naming you config, then assign it to @Injected.
Similiar with @RequestMapping on controller layers or @Service on DAO layers. Of course, it also rely on Java naming convention, which is in JNDI.

1 Like

Bạn thử Spring In Action 4th edition của Craig Walls xem. Viết khá hay và chi tiết.

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?