Skip to content

Instantly share code, notes, and snippets.

:octocat:

K. Siva Prasad Reddy sivaprasadreddy

:octocat:
Block or report user

Report or block sivaprasadreddy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sivaprasadreddy
sivaprasadreddy / pom.xml
Last active Aug 29, 2015
SpringApp pom.xml
View pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sivalabs</groupId>
<artifactId>spring-javaconfig</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>SpringApp JavaConfig Demo</name>
<properties>
@sivaprasadreddy
sivaprasadreddy / application.properties
Created Mar 2, 2014
application.properties with DB, Hibernate and Email configuration
View application.properties
################### DataSource Configuration ##########################
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test
jdbc.username=root
jdbc.password=admin
init-db=false
View spring-data-rest-pom.xml
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.0.0.RELEASE</version>
View AppConfig.java
package com.sivalabs.springapp.config;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@sivaprasadreddy
sivaprasadreddy / SampleEntities.java
Created Mar 2, 2014
JPA Entities for Spring Data REST demo
View SampleEntities.java
@Entity
@Table(name = "USERS")
public class User implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
private Integer id;
View PersistenceConfig.java
package com.sivalabs.springapp.config;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
View WebMvcConfig.java
package com.sivalabs.springapp.web.config;
import java.util.Properties;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.ViewResolver;
@sivaprasadreddy
sivaprasadreddy / SpringDataREST-SpringWebAppInitializer.java
Created Mar 2, 2014
SpringDataREST SpringWebAppInitializer.java
View SpringDataREST-SpringWebAppInitializer.java
package com.sivalabs.springdatarest.web.config;
import javax.servlet.Filter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import com.sivalabs.springdatarest.config.AppConfig;
View SpringWebAppInitializer.java
package com.sivalabs.springapp.web.config;
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import com.sivalabs.springapp.config.AppConfig;
public class SpringWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer
View SecurityUser.java
package com.sivalabs.springapp.web.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.sivalabs.springapp.entities.Role;
You can’t perform that action at this time.