diff --git a/spring-userservice/.springBeans b/spring-userservice/.springBeans
new file mode 100644
index 0000000000..ff32b84d3b
--- /dev/null
+++ b/spring-userservice/.springBeans
@@ -0,0 +1,15 @@
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-userservice/pom.xml b/spring-userservice/pom.xml
new file mode 100644
index 0000000000..5edaf15d9b
--- /dev/null
+++ b/spring-userservice/pom.xml
@@ -0,0 +1,310 @@
+
+ 4.0.0
+ spring-userservice
+ spring-userservice
+ 0.0.1-SNAPSHOT
+ war
+
+
+
+
+
+
+ org.springframework
+ spring-orm
+ ${org.springframework.version}
+
+
+ org.springframework
+ spring-context
+ ${org.springframework.version}
+
+
+
+
+
+ org.hibernate
+ hibernate-entitymanager
+ ${hibernate.version}
+
+
+ org.hibernate
+ hibernate-ehcache
+ ${hibernate.version}
+
+
+ xml-apis
+ xml-apis
+ 1.4.01
+
+
+ org.javassist
+ javassist
+ ${javassist.version}
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector-java.version}
+ runtime
+
+
+ org.springframework.data
+ spring-data-jpa
+ ${spring-data-jpa.version}
+
+
+ com.h2database
+ h2
+ ${h2.version}
+
+
+
+
+
+ org.hibernate
+ hibernate-validator
+ ${hibernate-validator.version}
+
+
+ javax.el
+ javax.el-api
+ 2.2.5
+
+
+
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+ test
+
+
+
+ org.springframework
+ spring-test
+ ${org.springframework.version}
+ test
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+
+ org.hamcrest
+ hamcrest-core
+ ${org.hamcrest.version}
+ test
+
+
+ org.hamcrest
+ hamcrest-library
+ ${org.hamcrest.version}
+ test
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
+
+
+ org.springframework
+ spring-core
+ ${org.springframework.version}
+
+
+ org.springframework
+ spring-web
+ ${org.springframework.version}
+
+
+ org.springframework
+ spring-webmvc
+ ${org.springframework.version}
+
+
+
+ javax.servlet
+ servlet-api
+ 3.0-alpha-1
+
+
+ org.springframework.security
+ spring-security-core
+ ${org.springframework.security.version}
+
+
+ org.springframework.security
+ spring-security-web
+ ${org.springframework.security.version}
+
+
+ org.springframework.security
+ spring-security-config
+ ${org.springframework.security.version}
+
+
+
+ org.apache.derby
+ derby
+ 10.12.1.1
+
+
+ org.apache.derby
+ derbyclient
+ 10.12.1.1
+
+
+ org.apache.derby
+ derbynet
+ 10.12.1.1
+
+
+ org.apache.derby
+ derbytools
+ 10.12.1.1
+
+
+ taglibs
+ standard
+ 1.1.2
+
+
+ org.springframework.security
+ spring-security-taglibs
+ 4.1.3.RELEASE
+
+
+ javax.servlet.jsp.jstl
+ jstl-api
+ 1.2
+
+
+
+
+ spring-userservice
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ 1.8
+ 1.8
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ ${maven-war-plugin.version}
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+
+
+
+
+
+
+
+
+
+ org.codehaus.cargo
+ cargo-maven2-plugin
+ ${cargo-maven2-plugin.version}
+
+ true
+
+ jetty8x
+ embedded
+
+
+
+
+
+
+ 8082
+
+
+
+
+
+
+
+
+
+
+
+ 4.1.3.RELEASE
+ 4.3.2.RELEASE
+ 3.20.0-GA
+
+
+ 5.2.2.Final
+ 5.1.38
+ 1.10.2.RELEASE
+ 1.4.192
+
+
+ 1.7.13
+ 1.1.3
+
+
+ 5.2.2.Final
+
+
+ 19.0
+ 3.4
+
+
+ 1.3
+ 4.12
+ 1.10.19
+
+ 4.4.1
+ 4.5
+
+ 2.9.0
+
+
+ 3.5.1
+ 2.6
+ 2.19.1
+ 2.7
+ 1.4.18
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-userservice/src/main/java/org/baeldung/custom/config/MvcConfig.java b/spring-userservice/src/main/java/org/baeldung/custom/config/MvcConfig.java
new file mode 100644
index 0000000000..4a9e737a92
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/custom/config/MvcConfig.java
@@ -0,0 +1,42 @@
+package org.baeldung.custom.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+import org.springframework.web.servlet.view.JstlView;
+
+@EnableWebMvc
+@Configuration
+@ComponentScan(basePackages = { "org.baeldung.security" })
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+
+ registry.addViewController("/");
+ registry.addViewController("/index");
+ registry.addViewController("/login");
+ registry.addViewController("/register");
+ }
+
+ @Bean
+ public ViewResolver viewResolver() {
+ final InternalResourceViewResolver bean = new InternalResourceViewResolver();
+
+ bean.setViewClass(JstlView.class);
+ bean.setPrefix("/WEB-INF/view/");
+ bean.setSuffix(".jsp");
+
+ return bean;
+ }
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java b/spring-userservice/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java
new file mode 100644
index 0000000000..6be7053b78
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java
@@ -0,0 +1,89 @@
+package org.baeldung.custom.config;
+
+import java.util.Properties;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+import org.baeldung.user.dao.MyUserDAO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
+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 com.google.common.base.Preconditions;
+
+@Configuration
+@EnableTransactionManagement
+@PropertySource({ "classpath:persistence-derby.properties" })
+public class PersistenceDerbyJPAConfig {
+
+ @Autowired
+ private Environment env;
+
+ public PersistenceDerbyJPAConfig() {
+ super();
+ }
+
+ // beans
+
+ @Bean
+ public LocalContainerEntityManagerFactoryBean myEmf() {
+ final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
+ em.setDataSource(dataSource());
+ em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
+
+ final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
+ em.setJpaVendorAdapter(vendorAdapter);
+ em.setJpaProperties(additionalProperties());
+
+ return em;
+ }
+
+ @Bean
+ public DataSource dataSource() {
+ final DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
+ dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
+ dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
+ dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass")));
+
+ return dataSource;
+ }
+
+ @Bean
+ public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
+ final JpaTransactionManager transactionManager = new JpaTransactionManager();
+ transactionManager.setEntityManagerFactory(emf);
+ return transactionManager;
+ }
+
+ @Bean
+ public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
+ return new PersistenceExceptionTranslationPostProcessor();
+ }
+
+ final Properties additionalProperties() {
+ final Properties hibernateProperties = new Properties();
+ hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
+ hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
+ hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache"));
+ hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache"));
+ // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
+ return hibernateProperties;
+ }
+
+ @Bean
+ public MyUserDAO myUserDAO() {
+ final MyUserDAO myUserDAO = new MyUserDAO();
+ return myUserDAO;
+ }
+}
\ No newline at end of file
diff --git a/spring-userservice/src/main/java/org/baeldung/custom/config/SecSecurityConfig.java b/spring-userservice/src/main/java/org/baeldung/custom/config/SecSecurityConfig.java
new file mode 100644
index 0000000000..44df02980f
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/custom/config/SecSecurityConfig.java
@@ -0,0 +1,75 @@
+package org.baeldung.custom.config;
+
+import org.baeldung.security.MyUserDetailsService;
+import org.baeldung.user.service.MyUserService;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@Configuration
+@EnableWebSecurity
+@Profile("!https")
+public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ public SecSecurityConfig() {
+ super();
+ }
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.authenticationProvider(authenticationProvider());
+ // @formatter:on
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http
+ .csrf().disable()
+ .authorizeRequests()
+ .antMatchers("/*").permitAll()
+ .and()
+ .formLogin()
+ .loginPage("/login")
+ .loginProcessingUrl("/login")
+ .defaultSuccessUrl("/",true)
+ .failureUrl("/login?error=true")
+ .and()
+ .logout()
+ .logoutUrl("/logout")
+ .deleteCookies("JSESSIONID")
+ .logoutSuccessUrl("/");
+ // @formatter:on
+ }
+
+ @Bean
+ public DaoAuthenticationProvider authenticationProvider() {
+ final DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
+ authProvider.setUserDetailsService(myUserDetailsService());
+ authProvider.setPasswordEncoder(encoder());
+ return authProvider;
+ }
+
+ @Bean
+ public PasswordEncoder encoder() {
+ return new BCryptPasswordEncoder(11);
+ }
+
+ @Bean
+ public MyUserDetailsService myUserDetailsService() {
+ return new MyUserDetailsService();
+ }
+
+ @Bean
+ public MyUserService myUserService() {
+ return new MyUserService();
+ }
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/persistence/model/MyUser.java b/spring-userservice/src/main/java/org/baeldung/persistence/model/MyUser.java
new file mode 100644
index 0000000000..804d391641
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/persistence/model/MyUser.java
@@ -0,0 +1,50 @@
+package org.baeldung.persistence.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
+@Table(schema = "spring_custom_user_service")
+public class MyUser {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private int id;
+
+ @Column(unique = true, nullable = false)
+ private String username;
+
+ @Column(nullable = false)
+ private String password;
+
+ public MyUser() {
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(final int id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(final String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/security/MyUserDetailsService.java b/spring-userservice/src/main/java/org/baeldung/security/MyUserDetailsService.java
new file mode 100644
index 0000000000..4c02f53d20
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/security/MyUserDetailsService.java
@@ -0,0 +1,37 @@
+package org.baeldung.security;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.baeldung.persistence.model.MyUser;
+import org.baeldung.user.dao.MyUserDAO;
+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;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+
+@Service("userDetailsService")
+public class MyUserDetailsService implements UserDetailsService {
+
+ @Autowired
+ MyUserDAO myUserDAO;
+
+ @Override
+ public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
+ final MyUser user = myUserDAO.findByUsername(username);
+
+ if (user == null) {
+ throw new UsernameNotFoundException("No user found with username: " + username);
+ }
+ else {
+ final Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
+ return new User(user.getUsername(), user.getPassword(), authorities);
+ }
+ }
+
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/security/UserController.java b/spring-userservice/src/main/java/org/baeldung/security/UserController.java
new file mode 100644
index 0000000000..b1c96e72c0
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/security/UserController.java
@@ -0,0 +1,52 @@
+package org.baeldung.security;
+
+import javax.annotation.Resource;
+
+import org.baeldung.user.service.MyUserService;
+import org.baeldung.web.MyUserDto;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+public class UserController {
+
+ @Resource
+ MyUserService myUserService;
+
+ @RequestMapping(value = "/register", method = RequestMethod.POST)
+ public String registerUserAccount(final MyUserDto accountDto, final Model model) {
+ final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+ model.addAttribute("name", auth.getName());
+ try {
+ myUserService.registerNewUserAccount(accountDto);
+ model.addAttribute("message", "Registration successful");
+ return "index";
+ }
+ catch(final Exception exc){
+ model.addAttribute("message", "Registration failed");
+
+ return "index";
+ }
+ }
+
+ @RequestMapping(value = "/", method = RequestMethod.GET)
+ public String getHomepage(final Model model) {
+ final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+ model.addAttribute("name", auth.getName());
+ return "index";
+ }
+
+ @RequestMapping(value = "/register", method = RequestMethod.GET)
+ public String getRegister() {
+ return "register";
+ }
+
+ @RequestMapping(value = "/login", method = RequestMethod.GET)
+ public String getLogin() {
+ return "login";
+ }
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/user/dao/MyUserDAO.java b/spring-userservice/src/main/java/org/baeldung/user/dao/MyUserDAO.java
new file mode 100644
index 0000000000..5741d19bf2
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/user/dao/MyUserDAO.java
@@ -0,0 +1,40 @@
+package org.baeldung.user.dao;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.baeldung.persistence.model.MyUser;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class MyUserDAO {
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ public MyUser findByUsername(final String username) {
+ final Query query = entityManager.createQuery("from MyUser where username=:username", MyUser.class);
+ query.setParameter("username", username);
+ final List result = query.getResultList();
+ if (result != null && result.size() > 0) {
+ return result.get(0);
+ } else
+ return null;
+ }
+
+ public MyUser save(final MyUser user) {
+ entityManager.persist(user);
+ return user;
+ }
+
+ public EntityManager getEntityManager() {
+ return entityManager;
+ }
+
+ public void setEntityManager(final EntityManager entityManager) {
+ this.entityManager = entityManager;
+ }
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/user/service/MyUserService.java b/spring-userservice/src/main/java/org/baeldung/user/service/MyUserService.java
new file mode 100644
index 0000000000..f4705f3193
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/user/service/MyUserService.java
@@ -0,0 +1,45 @@
+package org.baeldung.user.service;
+
+import org.baeldung.persistence.model.MyUser;
+import org.baeldung.user.dao.MyUserDAO;
+import org.baeldung.web.MyUserDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class MyUserService {
+
+ @Autowired
+ private PasswordEncoder passwordEncoder;
+
+ @Autowired
+ MyUserDAO myUserDAO;
+
+ public MyUser registerNewUserAccount(final MyUserDto accountDto) throws Exception {
+ if (usernameExists(accountDto.getUsername())) {
+ throw new Exception("There is an account with that username: " + accountDto.getUsername());
+ }
+ final MyUser user = new MyUser();
+
+ user.setUsername(accountDto.getUsername());
+ user.setPassword(passwordEncoder.encode(accountDto.getPassword()));
+ return myUserDAO.save(user);
+ }
+
+ public MyUser getUserByUsername(final String username) {
+ final MyUser user = myUserDAO.findByUsername(username);
+ return user;
+ }
+
+ private boolean usernameExists(final String username) {
+ final MyUser user = myUserDAO.findByUsername(username);
+ if (user != null) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/spring-userservice/src/main/java/org/baeldung/web/MyUserDto.java b/spring-userservice/src/main/java/org/baeldung/web/MyUserDto.java
new file mode 100644
index 0000000000..c572208913
--- /dev/null
+++ b/spring-userservice/src/main/java/org/baeldung/web/MyUserDto.java
@@ -0,0 +1,29 @@
+package org.baeldung.web;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+public class MyUserDto {
+ @NotNull
+ @Size(min = 1)
+ private String username;
+
+ private String password;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(final String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+
+}
diff --git a/spring-userservice/src/main/resources/persistence-derby.properties b/spring-userservice/src/main/resources/persistence-derby.properties
new file mode 100644
index 0000000000..e808fdc288
--- /dev/null
+++ b/spring-userservice/src/main/resources/persistence-derby.properties
@@ -0,0 +1,12 @@
+# jdbc.X
+jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
+jdbc.url=jdbc:derby:memory:spring_custom_user_service;create=true
+jdbc.user=tutorialuser
+jdbc.pass=tutorialpass
+
+# hibernate.X
+hibernate.dialect=org.hibernate.dialect.DerbyDialect
+hibernate.show_sql=false
+hibernate.hbm2ddl.auto=create
+hibernate.cache.use_second_level_cache=false
+hibernate.cache.use_query_cache=false
\ No newline at end of file
diff --git a/spring-userservice/src/main/webapp/META-INF/MANIFEST.MF b/spring-userservice/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..254272e1c0
--- /dev/null
+++ b/spring-userservice/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/spring-userservice/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml b/spring-userservice/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml
new file mode 100644
index 0000000000..25d1d4d22f
--- /dev/null
+++ b/spring-userservice/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /WEB-INF/views/
+
+
+ .jsp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${hibernate.hbm2ddl.auto}
+ ${hibernate.dialect}
+ ${hibernate.cache.use_second_level_cache}
+ ${hibernate.cache.use_query_cache}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-userservice/src/main/webapp/WEB-INF/views/index.jsp b/spring-userservice/src/main/webapp/WEB-INF/views/index.jsp
new file mode 100644
index 0000000000..0c89257cd2
--- /dev/null
+++ b/spring-userservice/src/main/webapp/WEB-INF/views/index.jsp
@@ -0,0 +1,35 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="c"
+ uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
+
+
+
+
+
+Welcome!
+
+
+
+
+
+
+
+Register
+
+
+Login
+
+
+${message }
+
+
+Hello, ${name }!
+
+
+Logout
+
+
+
+
\ No newline at end of file
diff --git a/spring-userservice/src/main/webapp/WEB-INF/views/login.jsp b/spring-userservice/src/main/webapp/WEB-INF/views/login.jsp
new file mode 100644
index 0000000000..29431f426d
--- /dev/null
+++ b/spring-userservice/src/main/webapp/WEB-INF/views/login.jsp
@@ -0,0 +1,29 @@
+<%@ taglib prefix="c"
+ uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+ Login
+
+
+ Username or password invalid!
+
+
\ No newline at end of file
diff --git a/spring-userservice/src/main/webapp/WEB-INF/views/register.jsp b/spring-userservice/src/main/webapp/WEB-INF/views/register.jsp
new file mode 100644
index 0000000000..e6e9d373a0
--- /dev/null
+++ b/spring-userservice/src/main/webapp/WEB-INF/views/register.jsp
@@ -0,0 +1,23 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="c"
+ uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+Welcome!
+
+
+
+
+
+Register here:
+
+
+
+
\ No newline at end of file
diff --git a/spring-userservice/src/main/webapp/WEB-INF/web.xml b/spring-userservice/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..b526774179
--- /dev/null
+++ b/spring-userservice/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+
+
+
+ Spring MVC Application
+
+
+
+
+
+ mvc-dispatcher
+ org.springframework.web.servlet.DispatcherServlet
+ 1
+
+
+ mvc-dispatcher
+ /
+
+
+
+
+ springSecurityFilterChain
+ org.springframework.web.filter.DelegatingFilterProxy
+
+
+ springSecurityFilterChain
+ /*
+
+
+
+ index.jsp
+
+
+
\ No newline at end of file