Which option is better ?
I have an interceptor PermissionInterceptor which needs access to message source.
As far as I know it can be done by autowiring message source or implementing MessageSourceAware interface as follows.
public class PermissionInterceptor extends HandlerInterceptorAdapter {
private MessageSource messageSource;
@Autowired
public void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}
}
or
public class PermissionInterceptor extends HandlerInterceptorAdapter implements MessageSourceAware {
private MessageSource messageSource;
public void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}
}
Which option is better? Any pros and cons?