Skip to content

Commit

Permalink
Complete Crud Operation on Branch with RestController
Browse files Browse the repository at this point in the history
  • Loading branch information
finnozo committed Nov 3, 2017
1 parent 5faa888 commit c22f104
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>1.9</java.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
Expand All @@ -17,5 +14,4 @@ public BCryptPasswordEncoder passwordEncoder() {
return bCryptPasswordEncoder;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.isolutions4u.retailbanking.repository.RoleRepository;
import com.isolutions4u.retailbanking.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

Expand All @@ -14,10 +15,15 @@
@Service("userService")
public class UserServiceImpl implements UserService {

@Qualifier("userRepository")
@Autowired
private UserRepository userRepository;

@Qualifier("roleRepository")
@Autowired
private RoleRepository roleRepository;


@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

Expand All @@ -31,7 +37,7 @@ public void saveUser(User user) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
user.setActive(1);
Role userRole = roleRepository.findByRole("ADMIN");
user.setRoles(new HashSet<Role>(Arrays.asList(userRole)));
user.setRoles(new HashSet<>(Arrays.asList(userRole)));
userRepository.save(user);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.isolutions4u.retailbanking.test;


public class UtilityTest {

public static void main(String[] args) {

}
}

0 comments on commit c22f104

Please sign in to comment.