When use ResponseEntity and @RestController for Spring RESTful applications

I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity<T> For example: @Controller @RequestMapping(“/person”) @Profile(“responseentity”) public class PersonRestResponseEntityController { With the method (just to create) @RequestMapping(value=”https://stackoverflow.com/”, method=RequestMethod.POST) public ResponseEntity<Void> createPerson(@RequestBody Person person, UriComponentsBuilder ucb){ logger.info(“PersonRestResponseEntityController – createPerson”); if(person==null) logger.error(“person is null!!!”); else logger.info(“{}”, person.toString()); personMapRepository.savePerson(person); … Read more

Understanding Spring @Autowired usage

I am reading the spring 3.0.x reference documentation to understand Spring Autowired annotation: 3.9.2 @Autowired and @Inject I am not able to understand the below examples. Do we need to do something in the XML for it to work? EXAMPLE 1 public class SimpleMovieLister { private MovieFinder movieFinder; @Autowired public void setMovieFinder(MovieFinder movieFinder) { this.movieFinder … Read more

Difference between and

I’m learning Spring 3 and I don’t seem to grasp the functionality behind <context:annotation-config> and <context:component-scan>. From what I’ve read they seem to handle different annotations (@Required, @Autowired etc vs @Component, @Repository, @Service etc), but also from what I’ve read they register the same bean post processor classes. To confuse me even more, there is … Read more