Created
August 2, 2011 12:05
-
-
Save criminy/1120065 to your computer and use it in GitHub Desktop.
Example Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package us.gaje.example.web; | |
public class ExampleWebAppInitializer extends GajeStandardWebAppInitializer{ | |
@Override | |
protected WebApplicationContext createWebApplicationContext() { | |
AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); | |
root.getEnvironment().setDefaultProfiles("embedded"); | |
root.scan("us.gaje.example.web.config"); | |
return root; | |
} | |
@Override | |
protected void createSpringSecurityFilterChain(ServletContext sc) { | |
//disable spring security | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package us.gaje.example.web.controllers; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestMethod; | |
import org.springframework.web.bind.annotation.ResponseBody; | |
@Controller | |
@RequestMapping(value="/") | |
public class HelloWorldController { | |
@RequestMapping(produces="text/plain",method=RequestMethod.GET) | |
public @ResponseBody String index() { | |
return "Hello World!"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>us.gaje.example</groupId> | |
<artifactId>example-web-application</artifactId> | |
<version>1.0</version> | |
<name>EXAMPLE : WEB</name> | |
<description>Example Web Application</description> | |
<packaging>war</packaging> | |
<properties> | |
<gaje.version>3.0.0-SNAPSHOT</gaje.version> | |
<gaje.groupId>us.gaje</gaje.groupId> | |
<org.aspectj-version>1.6.11</org.aspectj-version> | |
<org.slf4j-version>1.6.1</org.slf4j-version> | |
<spring.version>3.1.0.BUILD-SNAPSHOT</spring.version> | |
<java-version>1.6</java-version> | |
</properties> | |
<dependencies> | |
<!-- GAJE --> | |
<dependency> | |
<groupId>${gaje.groupId}</groupId> | |
<artifactId>gaje-web-common</artifactId> | |
<version>${gaje.version}</version> | |
</dependency> | |
<!-- Logging --> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-api</artifactId> | |
<version>${org.slf4j-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>jcl-over-slf4j</artifactId> | |
<version>${org.slf4j-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-log4j12</artifactId> | |
<version>${org.slf4j-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>log4j</groupId> | |
<artifactId>log4j</artifactId> | |
<version>1.2.16</version> | |
</dependency> | |
<!-- AspectJ --> | |
<dependency> | |
<groupId>org.aspectj</groupId> | |
<artifactId>aspectjrt</artifactId> | |
<version>${org.aspectj-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-aspects</artifactId> | |
<version>${spring.version}</version> | |
</dependency> | |
<!-- Remove once spring-aspects marks JPA as optional --> | |
<dependency> | |
<groupId>javax.persistence</groupId> | |
<artifactId>persistence-api</artifactId> | |
<version>1.0</version> | |
<scope>provided</scope> | |
</dependency> | |
<!-- required for some reason --> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-tx</artifactId> | |
<version>${spring.version}</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<resources> | |
<resource> | |
<directory>src/main/java</directory> | |
</resource> | |
<resource> | |
<directory>src/main/resources</directory> | |
</resource> | |
</resources> | |
<testResources> | |
<testResource> | |
<directory>src/test/java</directory> | |
</testResource> | |
<testResource> | |
<directory>src/test/resources</directory> | |
</testResource> | |
</testResources> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/ --> | |
<source>1.6</source> | |
<target>1.6</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-surefire-plugin</artifactId> | |
<version>2.9</version> | |
<configuration> | |
<environmentVariables> | |
<spring.profiles.active>embedded</spring.profiles.active> | |
</environmentVariables> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>aspectj-maven-plugin</artifactId> | |
<version>1.3.1</version> | |
<dependencies> | |
<!-- Note: Maven 2.0.9 or > required or these are ignored (MNG-2972) --> | |
<dependency> | |
<groupId>org.aspectj</groupId> | |
<artifactId>aspectjrt</artifactId> | |
<version>${org.aspectj-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.aspectj</groupId> | |
<artifactId>aspectjtools</artifactId> | |
<version>${org.aspectj-version}</version> | |
</dependency> | |
</dependencies> | |
<executions> | |
<execution> | |
<goals> | |
<goal>compile</goal> | |
<goal>test-compile</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<outxml>true</outxml> | |
<aspectLibraries> | |
<aspectLibrary> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-aspects</artifactId> | |
</aspectLibrary> | |
</aspectLibraries> | |
<source>${java-version}</source> | |
<target>${java-version}</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-war-plugin</artifactId> | |
<version>2.1.1</version> | |
<configuration> | |
<failOnMissingWebXml>false</failOnMissingWebXml> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
<profiles> | |
<profile> | |
<id>dev</id> | |
<activation> | |
<activeByDefault>true</activeByDefault> | |
</activation> | |
<build> | |
<plugins> | |
<!-- Tomcat 7 Plugin --> | |
<plugin> | |
<groupId>com.googlecode.t7mp</groupId> | |
<artifactId>maven-t7-plugin</artifactId> | |
<version>0.9.7</version> | |
<configuration> | |
<tomcatVersion>7.0.16</tomcatVersion> | |
<systemProperties> | |
<systemProperty> | |
<key>spring.profiles.active</key> | |
<value>embedded</value> | |
</systemProperty> | |
</systemProperties> | |
<tomcatConfigDirectory>${basedir}/src/main/tomcat-dev/conf | |
</tomcatConfigDirectory> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</profile> | |
</profiles> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tiles-definitions> | |
<definition name="page" > | |
</definition> | |
</tiles-definitions> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package us.gaje.example.web.config; | |
@Configuration | |
@EnableWebMvc | |
@ComponentScan(basePackages = { "us.gaje.example.web.controllers" }) | |
public class WebConfiguration extends GajeStandardWebConfig{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment