Tag: spring 3

EJB 3.1还是Spring 3.什么时候select哪一个?

EJB在3.x版本中取得了许多改进,Spring也是常用的,版本3是一个很好的select。 网上有很多文章,但是没有关于ejb3x和spring3x的完全比较。你有没有关于它们的任何想法,在现实世界的例子中哪个更好在哪些条件? 例如,我们要分开数据库和服务器,这意味着我们的应用程序将在服务器上,我们的数据库将在另一台服务器。EJB远程与Cluster4Spring等? 做每一个@Annotation总是好的? configuration不需要?

当为Spring REST风格的应用程序使用ResponseEntity <T>和@RestController时

我正在使用Spring Framework 4.0.7以及MVC和Rest 我可以和平地工作: @Controller ResponseEntity<T> 例如: @Controller @RequestMapping("/person") @Profile("responseentity") public class PersonRestResponseEntityController { 用这个方法(只是为了创build) @RequestMapping(value="/", 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); HttpHeaders headers = new HttpHeaders(); headers.add("1", "uno"); //http://localhost:8080/spring-utility/person/1 headers.setLocation(ucb.path("/person/{id}").buildAndExpand(person.getId()).toUri()); return new ResponseEntity<>(headers, HttpStatus.CREATED); } 返回一些东西 @RequestMapping(value="/{id}", method=RequestMethod.GET) public ResponseEntity<Person> getPerson(@PathVariable […]

eventlisteners使用hibernate 4.0与spring 3.1.0.release?

这些jar子都是新发布的,并具有适用于Java EE应用程序的最新解决scheme。 但是我在hibernate.cfg.xml中指定hibernate侦听器时遇到了问题。 在3.1.0之前, LocalSessionFactroyBean持有一个保存eventlistener的属性。 但是3.1.0.release没有eventlisteners映射。 现在,我保留了saveorupdate,postload等模式对象的轨迹,因为它们没有被Springconfiguration。 你有解决这个问题的想法吗?

<context:annotation-config> vs <context:component-scan>之间的区别

我正在学习Spring 3,而我似乎并没有把握<context:annotation-config>和<context:component-scan>背后的function。 从我读过的,他们似乎处理不同的注释(@Required,@Autowired等与@Component,@Repository,@Service等),但也从我读了他们注册相同的豆后处理器类。 为了让我更加困惑,在<context:component-scan>上有一个annotation-config属性。 有人可以对这些标签有所了解吗? 什么是相似的,什么是不同的,是一个被另一个取代的,它们是完整的,我需要其中之一吗?