Saturday, 20 October 2012

RememberMe service in spring security is not working

In the Spring security they provide 2 ways to use the rememberMe service.

  1. In the rememberMeService Definition[Configuration file], "alwaysRememberMe" property should be true. First time when user tries to access the secure URL it will take user to login page. After first login, Application will not ask user to login again until user hits logout link or cookies has been deleted or expired.
  2. Other way we can provide check box on login screen to give freedom to user to choose, does he/she wants to save login or not.To make it work check box should be specified with name "_spring_security_remember_me" and value="true".Remember me service would not save user's credentials until user hits the checkbox.

Its working for me..

Friday, 19 October 2012

Association, Aggregation, Composition

There are 3 words which confuses every developer. So many time people ask in the interview.

Association keyword show the relationship between more than one entity, class or Object. The Relationship can be one to one , one to many and many to one.
it means two class are associated with each other via some relationship that called association.
Association can be shown by a "Arrow" sign.

Example: 1. Faculty and students are having association.
2. Students and library is having association.

Aggregation is a special form of the association. It shows "has-a" relationship of the object. A Objection has a another object.Like class has student object. If two object having "has-a" relationship then only we can get Aggregation.


Composition is a special form of the aggregation. when one object contains another object and contained object cann't exist without the container object,called composition. Like A student object cann't exist without class object. A relationship between class object and student object called composition.

So basically there is a difference between aggregation and composition is, in the composition contained object cann't exist or alive without container object but in the aggregation it can exist.