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
| <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" | |
| p:packagesToScan="org.krams.tutorial.domain" | |
| p:dataSource-ref="jpaDataSource" | |
| p:jpaVendorAdapter-ref="hibernateVendor" | |
| p:jpaPropertyMap-ref="jpaPropertyMap"/> | |
| <util:map id="jpaPropertyMap"> | |
| <entry key="hibernate.hbm2ddl.auto" value="update"/> | |
| <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> | |
| </util:map> |
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
| <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" | |
| p:persistenceXmlLocation="classpath*:META-INF/persistence.xml" | |
| p:persistenceUnitName="hibernatePersistenceUnit" | |
| p:dataSource-ref="jpaDataSource" | |
| p:jpaVendorAdapter-ref="hibernateVendor"/> | |
| <bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" | |
| p:showSql="false"/> |
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
| <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> | |
| <persistence-unit name="hibernatePersistenceUnit" transaction-type="RESOURCE_LOCAL"> | |
| <properties> | |
| <property name="hibernate.hbm2ddl.auto" value="update" /> | |
| <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> | |
| </properties> | |
| </persistence-unit> | |
| </persistence> |
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 org.krams.domain; | |
| import javax.persistence.CascadeType; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.Id; | |
| import javax.persistence.OneToOne; | |
| @Entity(name="user") | |
| public class User { |
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 org.krams.domain; | |
| import javax.persistence.Entity; | |
| import javax.persistence.Id; | |
| import javax.persistence.OneToOne; | |
| @Entity(name="role") | |
| public class Role { | |
| @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 org.krams.controller; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.ui.Model; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RequestParam; | |
| @Controller | |
| @RequestMapping | |
| public class AccessController { |
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 org.krams.controller; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| @Controller | |
| @RequestMapping("/") | |
| public class MediatorController { | |
| @RequestMapping |
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 org.krams.service; | |
| import java.util.ArrayList; | |
| import java.util.Collection; | |
| import java.util.List; | |
| import org.krams.repository.UserRepository; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.security.core.GrantedAuthority; | |
| import org.springframework.security.core.authority.SimpleGrantedAuthority; | |
| import org.springframework.security.core.userdetails.User; |
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 org.krams.repository; | |
| import org.krams.domain.User; | |
| import org.springframework.data.jpa.repository.JpaRepository; | |
| public interface UserRepository extends JpaRepository<User, Long> { | |
| User findByUsername(String username); | |
| } |
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 org.krams.aop; | |
| import org.aopalliance.intercept.MethodInvocation; | |
| import org.apache.commons.logging.Log; | |
| import org.apache.log4j.Logger; | |
| import org.springframework.aop.interceptor.CustomizableTraceInterceptor; | |
| /** | |
| * Extends {@link CustomizableTraceInterceptor} to provide custom logging levels | |
| */ |