I tried if there is a way to implement circuit breaker pattern in java using spring framework. However i am in vain and couldn't get any online help for the implementation. Just want to know if anywhere this has been experienced. If so please share the experiences as well any online references.
I am thinking if I can implement using spring AOP. Please suggest if it can be implemented using Spring AOP or if there is any other way
Spring AOP definitely is a good solution for this pattern.
You need to use the 'around' type of advice, or a combination of the other advices.
The 'around' type is probably the best for this case, as it looks like you will do monitoring most likely: after an execution, or when an exception is thrown, or, break the circuit before an execution, if the condition is met.
The condition will depend on a 'state'. You will therefore need the advice bean to be stateful, otherwise you will need a way to keep the state somewhere. An example of the 'state' is a count of how many failures has there been.
By the way, a great way to learn Spring AOP is to read the Spring In Action book chapter/s on AOP. Use the book edition based on Spring 4 if you will use spring 4. There is also a book version for spring 3, but spring 3 is quite relatively 'old' now.
I'm not aware of any existing projects with available source code that does this. You might be able to find one if you search for it, but for learning purposes you'd be better to take John's advice and read up on Spring AOP, after which you'll know how to use it to solve your problem.