Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Java
Hi i'm learning spring framework and planning to do a small project. the below link seems very useful but being a beginner, i cannot understand. Can anyone explain the project from the below link?

https://github.com/jackcrews/ProgrammingProblem.git


What I have tried:

I know Java and some spring basics but this is something new for me like @Configuration, @bean, and mainly i want to understand the usage of IOC here.
Posted
Updated 19-Apr-16 4:09am
Comments
Sergey Alexandrovich Kryukov 19-Apr-16 9:16am    
This is not really a question. Why would you possibly mean by such help? Define "help to understand"?

Do you mean Inversion of Control? Do you know what is it, how it works and why is it important?

—SA
Virat Panday 20-Apr-16 3:39am    
Hi Thanks for your reply.

I just want to know how IOC is used in this project? I have experienced on BeanFactory but not on ApplicationContext and also i dont understand why we need a Config.java file to instantiate beans? According to my knowledge.., If we use ApplicationContext IOC, then that instantiates all the beans which we defined in configuration file during server start-up itself and it doesn't wait for someone to call getBean() method to instantiate beans like BeanFactory.

1 solution

In pseudo code it's reasonably simple, you have two parts a client and a service

The service expects the client to call validate with a password(s).
The service then checks the password(s) for a number of things
- checkLength .......... must contain 5-12 characters
- checkCase ......... must contain a mixture of cases
- checkLetterAndDigit ... must contain letters and digits
- checkSequenceRepetition ... must not contain repeats

Any errors are returned in a string list by the server
The client displays the errant password list.

Correct passwords do nothing and are basically ignored.

That is all the code does and you should be able to work out the various bits now.
 
Share this answer
 
v3
Comments
Virat Panday 20-Apr-16 3:34am    
Hi Leon de boer,

Thanks for your reply.

I dont understand what do you mean by two parts of client.

According to my understanding(Please Correct me if i'm wrong).., Client.java is the client code and PasswordService.java is the service here.

I want to know why they have written AppConfig.java? Is this file written only to instantiate the beans? And how IOC is used here?
leon de boer 20-Apr-16 11:38am    
Its just a container class so the client and service are paired. Imagine you had multiple clients and multiple services ... well actually try it :-)

Now go to PasswordServiceTest.java which is actually the injection test, and you will see the significance of AppConfig.java

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900