Spring support in projects

This page describes the generic support for Spring beans configuration files in Java projects and for Spring Web MVC in the web project.


Spring libraries

Libraries Spring Framework (containing spring.jar and commons-logging-1.1.jar) and Spring Web MVC (containig spring-webmvc.jar) are added to the Library Manager.

Beans configuration files


Wizards for creating commonly used Spring artifacts are available:

  • the New Spring XML Configuration File wizard creates a new Spring beans configuration file. This wizard asks the user which auxiliary Spring schemas have to be included in the generated beans configuration file and will generate the file accordingly. The wizard automatically adds the file to the list of configuration files and also provide UI allowing the user to add the new file to a config file group (see further). The wizard also display an Add Spring Framework which adds the Spring Framework library to the project classpath unless it has already been added.

Config file management

A new Spring Framework category will be added to the project customizer which allows the user to manage beans configuration files. The category is only visible in the category tree when the Spring Framework library is on the classpath or configuration files or groups have been added. The category will provide:

  • Configuration Files lists all known config files. This is the authoritative list of config files used by refactoring and other features that need to process all files. There user can add and remove files from it. There is also an Autodetect button whichs searches for files in the Java sources and also under WEB-INF in the case of a web project.
  • Configuration File Groups lists configuration file groups. The groups group together several configuration files. This is necessary because configuration files can reference each other implicitly and autodetection is not straightforward and might have negative performance implications. The user can add and remove groups, as well as add and remove files to the groups (the files are taken from the list of known config files).

Spring Web MVC

The Spring Web MVC framework will be registered in the list of frameworks and the user will be able to extend a web project with it from the New Project wizard and from the project customizer. The framework will present the user with a configuration panel allowing to:

  • enter name and URL mapping of the Spring dipatcher servlet
  • register the JSTL library, which is commonly used together with Spring Web MVC projects

While extending the project a basic application structure will be created, consisting of:

  • applicationContext.xml
  • ${dispatcher}-servlet, where ${dispatcher} is entered by the user in the config panel
  • an index.jsp file (actually a Spring view)
  • a redirect.jsp file which only redirects to index.jsp

Also, the Spring Framework and Spring Web MVC (and optionally JSTL) libraries are added to the project classpath.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo