Permalink
Browse files

Sample application created from archetype @ https://github.com/koloro…

  • Loading branch information...
0 parents commit a1c4f46d602abf878db446c2bd7a54230013a613 @sandermak committed Nov 7, 2012
Showing with 953 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +269 −0 pom.xml
  3. +65 −0 src/main/java/net/branchandbound/config/PersistenceConfig.java
  4. +19 −0 src/main/java/net/branchandbound/config/RootConfig.java
  5. +7 −0 src/main/java/net/branchandbound/config/SecurityConfig.java
  6. +39 −0 src/main/java/net/branchandbound/config/WebAppInitializer.java
  7. +97 −0 src/main/java/net/branchandbound/config/WebMvcConfig.java
  8. +73 −0 src/main/java/net/branchandbound/domain/User.java
  9. +31 −0 src/main/java/net/branchandbound/domain/UserRepository.java
  10. +37 −0 src/main/java/net/branchandbound/domain/UserService.java
  11. +15 −0 src/main/java/net/branchandbound/web/IndexController.java
  12. +37 −0 src/main/java/net/branchandbound/web/UserController.java
  13. +41 −0 src/main/resources/log4j.xml
  14. +7 −0 src/main/resources/persistence.properties
  15. +11 −0 src/main/resources/spring-global-method-security.xml
  16. +19 −0 src/main/resources/spring-security-context.xml
  17. +1 −0 src/main/webapp/WEB-INF/i18n/messages.properties
  18. +1 −0 src/main/webapp/WEB-INF/tiles/footer.jsp
  19. +2 −0 src/main/webapp/WEB-INF/tiles/header.jsp
  20. +19 −0 src/main/webapp/WEB-INF/tiles/template.jsp
  21. +10 −0 src/main/webapp/WEB-INF/tiles/tiles.xml
  22. +7 −0 src/main/webapp/WEB-INF/views/index.jsp
  23. +9 −0 src/main/webapp/WEB-INF/views/user/index.jsp
  24. +12 −0 src/main/webapp/WEB-INF/views/views.xml
  25. +6 −0 src/main/webapp/WEB-INF/web.xml
  26. 0 src/main/webapp/resources/css/style.css
  27. +75 −0 src/test/java/net/branchandbound/domain/UserServiceTest.java
  28. +41 −0 src/test/resources/log4j.xml
@@ -0,0 +1,3 @@
+*.iml
+.idea
+/target
@@ -0,0 +1,269 @@
+<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>net.branchandbound</groupId>
+ <artifactId>embedded-json-example</artifactId>
+ <packaging>war</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Spring MVC Application</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java-version>1.6</java-version>
+ <org.springframework-version>3.1.2.RELEASE</org.springframework-version>
+ <org.springframework.security-version>3.1.0.RELEASE</org.springframework.security-version>
+ <org.aspectj-version>1.6.9</org.aspectj-version>
+ <cglib-version>2.2.2</cglib-version>
+ <org.slf4j-version>1.5.10</org.slf4j-version>
+ <org.apache.tiles-version>2.2.2</org.apache.tiles-version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>Repository hosting the jee6 artifacts</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ <repository>
+ <id>sonatype-oss-repository</id>
+ <url>https://oss.sonatype.org/content/groups/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <dependencies>
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${org.springframework-version}</version>
+ <exclusions>
+ <!-- Exclude Commons Logging in favor of SLF4j -->
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+ <!-- Security -->
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-config</artifactId>
+ <version>${org.springframework.security-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-web</artifactId>
+ <version>${org.springframework.security-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-taglibs</artifactId>
+ <version>${org.springframework.security-version}</version>
+ </dependency>
+ <!-- Persistence -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.6.8.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ </dependency>
+ <!-- javax.validation (JSR-303) -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.2.0.Final</version>
+ </dependency>
+ <!-- Apache Tiles -->
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-jsp</artifactId>
+ <version>${org.apache.tiles-version}</version>
+ </dependency>
+ <!-- CGLIB -->
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>${cglib-version}</version>
+ </dependency>
+ <!-- AspectJ -->
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>${org.aspectj-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>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${org.slf4j-version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.15</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- @Inject -->
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <!-- Servlet -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <!-- JSON -->
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.9</version>
+ </dependency>
+ <!-- Test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${org.springframework-version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <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>
+ <warName>embedded-json-example-1.0.0-SNAPSHOT</warName>
+ <ignoreWebxml>false</ignoreWebxml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <goals>
+ <goal>sources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,65 @@
+package net.branchandbound.config;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.transaction.annotation.TransactionManagementConfigurer;
+
+@Configuration
+@EnableTransactionManagement
+public class PersistenceConfig implements TransactionManagementConfigurer {
+
+ @Value("${dataSource.driverClassName}")
+ private String driver;
+ @Value("${dataSource.url}")
+ private String url;
+ @Value("${dataSource.username}")
+ private String username;
+ @Value("${dataSource.password}")
+ private String password;
+ @Value("${hibernate.dialect}")
+ private String dialect;
+ @Value("${hibernate.hbm2ddl.auto}")
+ private String hbm2ddlAuto;
+
+ @Bean
+ public DataSource configureDataSource() {
+ DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ dataSource.setDriverClassName(driver);
+ dataSource.setUrl(url);
+ dataSource.setUsername(username);
+ dataSource.setPassword(password);
+ return dataSource;
+ }
+
+ @Bean
+ public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() {
+ LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
+ entityManagerFactoryBean.setDataSource(configureDataSource());
+ entityManagerFactoryBean.setPackagesToScan("net.branchandbound.domain");
+ entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
+
+ Properties jpaProperties = new Properties();
+ jpaProperties.put(org.hibernate.cfg.Environment.DIALECT, dialect);
+ jpaProperties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, hbm2ddlAuto);
+ entityManagerFactoryBean.setJpaProperties(jpaProperties);
+
+ return entityManagerFactoryBean;
+ }
+
+ @Bean
+ public PlatformTransactionManager annotationDrivenTransactionManager() {
+ return new JpaTransactionManager();
+ }
+
+}
@@ -0,0 +1,19 @@
+package net.branchandbound.config;
+
+import org.springframework.context.annotation.*;
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+import org.springframework.core.io.ClassPathResource;
+
+@Configuration
+@ComponentScan(basePackages = { "net.branchandbound.domain" })
+@Import({ PersistenceConfig.class, SecurityConfig.class })
+public class RootConfig {
+
+ @Bean
+ public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
+ PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
+ ppc.setLocation(new ClassPathResource("/persistence.properties"));
+ return ppc;
+ }
+
+}
@@ -0,0 +1,7 @@
+package net.branchandbound.config;
+
+import org.springframework.context.annotation.*;
+
+@Configuration
+@ImportResource(value = "classpath:spring-security-context.xml")
+public class SecurityConfig {}
Oops, something went wrong.

0 comments on commit a1c4f46

Please sign in to comment.