Created
August 13, 2012 11:53
-
-
Save mh-github/3339956 to your computer and use it in GitHub Desktop.
This file contains 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
<mvc:annotation-driven /> | |
<context:component-scan base-package="com.myproject"/> | |
<http auto-config="true" use-expressions="true"> | |
<intercept-url pattern="/index" access="permitAll"/> | |
<intercept-url pattern="/login" access="permitAll"/> | |
<intercept-url pattern="/**" access="hasRole('ROLE_USER') or hasRole('ROLE_ADMIN') and fullyAuthenticated" /> | |
<form-login login-page="/login" default-target-url="/home"/> | |
<logout invalidate-session="true" logout-url="/logout" logout-success-url="/"/> | |
</http> | |
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | |
<property name="prefix"> | |
<value>/WEB-INF/views/</value> | |
</property> | |
<property name="suffix"> | |
<value>.jsp</value> | |
</property> | |
</bean> | |
<!-- Data Source --> | |
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> | |
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> | |
<property name="url" value="jdbc:mysql://localhost:3306/myproject" /> | |
<property name="username" value="root" /> | |
<property name="password" value="" /> | |
</bean> | |
<!-- Hibernate --> | |
<tx:annotation-driven transaction-manager="transactionManager" /> | |
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> | |
<property name="dataSource" ref="dataSource" /> | |
<property name="annotatedClasses"> | |
<list> | |
<value>com.myproject.entities.User</value> | |
<value>com.myproject.entities.Role</value> | |
</list> | |
</property> | |
<property name="annotatedPackages"> | |
<list> | |
<value>com.myproject.entities</value> | |
</list> | |
</property> | |
<property name="hibernateProperties"> | |
<value> | |
hibernate.dialect=org.hibernate.dialect.MySQLDialect | |
hibernate.show_sql=true | |
hibernate.hbm2ddl.auto=update | |
</value> | |
</property> | |
</bean> | |
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" > | |
<property name="sessionFactory" ref="sessionFactory" /> | |
</bean> | |
<bean id="userService" class="com.myproject.services.UserServiceImpl"/> | |
<sec:authentication-manager> | |
<sec:authentication-provider user-service-ref="userService"/> | |
</sec:authentication-manager> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment