Pergunta

I haven't kept up with all of the changes to the spring framework since 2.5. I am looking for a sample application for 4.0 that has a basic skeleton app with hibernate done the 4.0 way with controllers and services.

I've googled and looked at the spring site, which I think has been made much worse in the last year or so. Can anyone help me out?

Foi útil?

Solução

Spring Guides

Take look at Spring Guides, all with Spring 4.0.

(..) these guides are designed to get you productive as quickly as possible – using the latest Spring project releases and techniques as recommended by the Spring team.

I think tutorial Data Access with Spring can help you, especially step 3:

with source code: https://github.com/spring-guides/tut-data

There is also Getting Started Guide, designed to be completed in 15-30 minutes

with source code: https://github.com/spring-guides/gs-accessing-data-jpa.

This give you general look at possibilites. You can use solutions from this (like Spring Data JPA etc) with or without Spring Boot.

Appfuse archetypes

There is also Appfuse 3.0 recently released with support for Spring 4.0.

AppFuse is a full-stack framework for building web applications on the JVM. It was originally developed to eliminate the ramp-up time when building new web applications. Over the years, it has matured into a very testable and secure system for creating Java-based webapps.

AppFuse is full of good patterns, simply build new project from appfuse archetype and take look.

Outras dicas

There is also an interesting project that helps you to bootstrap your spring app as easy and fast as possible. You probably would like to take a look. Spring Boot

If you are looking for normal application (not a web application but integration of Spring 4 with hibernate 4) then you can refer to My Blog. If you are interested in further integrate the same to Spring MVC you need to create controller class with annotation @Controller and autowire the same to respective Service class via @Service annotation.

Spring 4 comes with lot of new features. One of them is the support for Java 8 version. Here is the list of notable features included in the Spring 4 release.

  1. Spring MVC Test Framework
  2. Asynchronous MVC processing on Servlet 3.0
  3. custom @Bean definition annotations in @Configuration classes
  4. @Autowired and @Value to be used as meta-annotations
  5. Concurrency refinements across the framework
  6. loading WebApplicationContexts in the TestContext framework
  7. JCache 0.5 (JSR-107)

Also you can read the list of Spring 4 Tutorials.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top