spring:load

Full name:

org.kuali.maven.plugins:spring-maven-plugin:1.2.5-SNAPSHOT:load

Description:

This mojo provides the ability to load a Spring context XML file. It uses a lightweight integration technique between Spring and Maven centered around java.util.Properties. Prior to the Spring context being loaded, it is injected with a java.util.Properties object containing the full set of Maven properties. The java.util.Properties object is registered in the context as a bean under the name mavenProperties.

One common use of the injected Maven properties in a Spring context is for replacing property placeholders.

For example, to inject the Maven version number into a Spring context:

 <beans>
  <context:property-placeholder properties-ref="mavenProperties" />
  <bean id="version" class="java.lang.String">
   <constructor-arg value="${project.version}" />
  </bean>
 </beans>

Attributes:

  • Requires a Maven project to be executed.

Required Parameters

Name Type Since Description
location String - Location of a Spring context XML file. This can be a file on the local file system, or any URL Spring's Resource loading framework understands eg classpath:my-context.xml
Default value is: classpath:${project.artifactId}-context.xml.
serviceClassname String - The implementation of org.kuali.common.util.service.SpringService to use
Default value is: org.kuali.common.util.service.DefaultSpringService.

Optional Parameters

Name Type Since Description
forceMojoExecution boolean - By default, execution of this mojo is automatically skipped for Maven projects with a packaging of type pom. If forceMojoExecution is true this mojo will always execute. forceMojoExecution overrides skip.
Default value is: false.
injectMojo boolean - If true, this mojo object is injected into the Spring context
Default value is: false.
injectProject boolean - If true, the MavenProject object is injected into the Spring context
Default value is: false.
injectProperties boolean - If true, Maven properties are injected into the Spring context as a java.util.Properties object
Default value is: true.
locations List - List of additional Spring context XML files to load (if any).
mojoBeanName String - The name to use when registering this mojo object as a bean in the Spring context.
Default value is: mojo.
projectBeanName String - The name to use when registering the MavenProject object as a bean in the Spring context.
Default value is: project.
properties Properties - Additional properties to supply to the Spring context.
propertiesBeanName String - The name to use when registering the java.util.Properties object containing Maven properties as a bean in the Spring context.
Default value is: mavenProperties.
skip boolean - By default, execution of this mojo is automatically skipped for Maven projects with a packaging of type pom. Set this parameter to true to explicitly skip executing this mojo for other scenarios. NOTE: forceMojoExecution overrides skip.
Default value is: false.

Parameter Details

forceMojoExecution:

By default, execution of this mojo is automatically skipped for Maven projects with a packaging of type pom. If forceMojoExecution is true this mojo will always execute. forceMojoExecution overrides skip.
  • Type: boolean
  • Required: No
  • Expression: ${spring.forceMojoExecution}
  • Default: false

injectMojo:

If true, this mojo object is injected into the Spring context
  • Type: boolean
  • Required: No
  • Expression: ${spring.injectMojo}
  • Default: false

injectProject:

If true, the MavenProject object is injected into the Spring context
  • Type: boolean
  • Required: No
  • Expression: ${spring.injectProject}
  • Default: false

injectProperties:

If true, Maven properties are injected into the Spring context as a java.util.Properties object
  • Type: boolean
  • Required: No
  • Expression: ${spring.injectProperties}
  • Default: true

location:

Location of a Spring context XML file. This can be a file on the local file system, or any URL Spring's Resource loading framework understands eg classpath:my-context.xml
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${spring.location}
  • Default: classpath:${project.artifactId}-context.xml

locations:

List of additional Spring context XML files to load (if any).
  • Type: java.util.List
  • Required: No

mojoBeanName:

The name to use when registering this mojo object as a bean in the Spring context.
  • Type: java.lang.String
  • Required: No
  • Expression: ${spring.mojoBeanName}
  • Default: mojo

projectBeanName:

The name to use when registering the MavenProject object as a bean in the Spring context.
  • Type: java.lang.String
  • Required: No
  • Expression: ${spring.projectBeanName}
  • Default: project

properties:

Additional properties to supply to the Spring context.
  • Type: java.util.Properties
  • Required: No

propertiesBeanName:

The name to use when registering the java.util.Properties object containing Maven properties as a bean in the Spring context.
  • Type: java.lang.String
  • Required: No
  • Expression: ${spring.propertiesBeanName}
  • Default: mavenProperties

serviceClassname:

The implementation of org.kuali.common.util.service.SpringService to use
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${spring.serviceClassname}
  • Default: org.kuali.common.util.service.DefaultSpringService

skip:

By default, execution of this mojo is automatically skipped for Maven projects with a packaging of type pom. Set this parameter to true to explicitly skip executing this mojo for other scenarios. NOTE: forceMojoExecution overrides skip.
  • Type: boolean
  • Required: No
  • Expression: ${spring.skip}
  • Default: false