java - Why Spring MVC 4 and Hystrix integration not working without Spring boot API? -


before start let me tell i'm trying integrate spring mvc 4 application hystrix(i.e. using hystrix-javanica full annotation support). below piece of code....
configuration class:

@configuration public class beanconfig {      @bean     public hystrixcommandaspect hystrixcommandaspect() {         return new hystrixcommandaspect();     } } 

hystrix enabled service class

@service(value="userrepository") public class userrepositoryimpl implements userrepository{      @override     @hystrixcommand(fallbackmethod = "failservice",                     commandproperties = {                             @hystrixproperty(name = "execution.isolation.thread.timeoutinmilliseconds", value = "500")                     },                     threadpoolproperties = {                             @hystrixproperty(name = "coresize", value = "30"),                             @hystrixproperty(name = "maxqueuesize", value = "101"),                             @hystrixproperty(name = "keepalivetimeminutes", value = "2"),                             @hystrixproperty(name = "queuesizerejectionthreshold", value = "15"),                             @hystrixproperty(name = "metrics.rollingstats.numbuckets", value = "12"),                             @hystrixproperty(name = "metrics.rollingstats.timeinmilliseconds", value = "1440")                     })     public user getuserbyauthentication(string username) {         throw new runtimeexception("delegately throwing exception");//intentionally throwing exception check fallback service     }      @hystrixcommand     public user failservice(string username) {         system.out.println("in fallback service");         return new user(username);     } } 

and conrtroller class

@autowired @qualifier("userrepository") private userrepository userrepository;  @requestmapping(method = requestmethod.post) public string init(httpservletrequest request, httpservletresponse response) throws interruptedexception, executionexception {     system.out.println("in controller getting value :" + userrepository.getuserbyauthentication("testvalue"));     return "some page";      } 

now, when i'm running application exception getting thrown after no fallback service getting called. i've tried debug after exception workflow getting stopped.
can please me this?

when using aspectj spring (and without spring boot) need tell spring @aspect annotated beans detects. default ignored.

to need add @enableaspectjautoproxy on configuration (or <aop:aspectj-autoproxy /> in xml). instruct spring apply @aspect annotated beans detects in context.

all of quite extensively described in enabling @aspectj support section of spring reference guide.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -