Hi All, Our requirement is use to use STRUTS + REST + SPRING. We are stuck with the below problem: Rest controllers are not able to autowire the spring beans. So i am not able to inject the spring beans to the rest controllers that are created using convention plugin. 1) We configured the struts configuration as below:
< bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="myMapper" class="com.xxx.mapper.Struts2RestMapper" /> <constant name="struts.mapper.class" value="myMapper"/> <constant name="struts.convention.action.suffix" value="Controller"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.default.parent.package" value="rest-default"/> <constant name="struts.convention.package.locators" value="rest"/> 2) Struts2RestMapper is a custom ActionMapper to invoke the struts mapper or Rest mapper based on the request url. This is working fine however, rest controller is not working correctly due to failed dependencies. 3) Rest controller is pasted below. @Results ({ @Result(name="success", type="redirectAction", params = {"actionName" , "userrest"}) }) public class UserrestController extends ValidationAwareSupport implements ModelDriven<Object>, Validateable { private UserDetails user = null; private String userSignInId; @Autowired private UserDetailsService userService; public void validate() { //if (user.getClientName() == null || model.getClientName().length() ==0) { // addFieldError("clientName", "The client name is empty"); //} System. out.println("validate Method invoked"); } // GET /userrest public HttpHeaders index() { //list = messagesService.getAll(); System. out.println("Index method invoked"); return new DefaultHttpHeaders("index").disableCaching(); } public Object getModel() { return user; } // GET /userrest/1 public HttpHeaders show() { System. out.println("show Method invoked"); return new DefaultHttpHeaders("show"); } public void setId(String id) { System. out.println("setID Method invoked"); if (id != null) { this.user = userService.loadUserByUsername(id); } this.userSignInId = id; } } Please can some one guide me on how to get the rest controller to pick the spring beans (ie., userService in the above example) correctly. Kind Regards LV