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
| @Component("customAuthenticationFailureHandler") | |
| public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { | |
| private String DEFAULT_FAILURE_URL = "/login?error"; | |
| @Autowired | |
| private UserService userService; | |
| @Override | |
| public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, |
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 com.bytestree.restful; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| @SpringBootApplication | |
| public class Application { | |
| public static void main(String[] args) { | |
| SpringApplication.run(Application.class, args); |
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 com.bytestree.restful.controller; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import org.apache.log4j.Logger; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.PathVariable; |
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 com.bytestree.restful.service; | |
| import java.io.Serializable; | |
| import java.util.List; | |
| public interface CRUDService<E> { | |
| E save(E entity); | |
| E getById(Serializable id); |
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 com.bytestree.restful.model; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.GenerationType; | |
| import javax.persistence.Id; | |
| import javax.persistence.Table; | |
| @Entity |
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/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>com.bytestree.hibernate</groupId> | |
| <artifactId>generic-dao-hibernate</artifactId> | |
| <version>1.0.0-SNAPSHOT</version> | |
| <properties> | |
| <spring.version>4.2.5.RELEASE</spring.version> | |
| <hibernate.version>4.3.11.Final</hibernate.version> |
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 com.bytestree.model; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.GenerationType; | |
| import javax.persistence.Id; | |
| import javax.persistence.Table; | |
| @Entity |
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 com.bytestree; | |
| import java.util.List; | |
| import org.apache.log4j.Logger; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.stereotype.Component; | |
| import com.bytestree.model.Employee; | |
| import com.bytestree.service.EmployeeService; | |
| @Component |
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 com.bytestree; | |
| import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |
| import com.bytestree.config.AppConfiguration; | |
| public class TestApplication { | |
| public static void main(String[] args) { | |
| // Load the Spring context and beans | |
| AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfiguration.class); |
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 com.bytestree.dao; | |
| import java.io.Serializable; | |
| import java.lang.reflect.ParameterizedType; | |
| import java.util.List; | |
| import org.hibernate.Session; | |
| import org.hibernate.SessionFactory; | |
| import org.hibernate.criterion.Example; | |
| import org.springframework.beans.factory.annotation.Autowired; |
NewerOlder