Guest User

Untitled

a guest
Apr 22nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.29 KB | None | 0 0
  1. 03:35:05,193 WARN [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (ServerService Thread Pool -- 81) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through method 'setAuthenticationProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'daoAuthenticationProvider' defined in class path resource [com/ipayso/config/SecurityConfiguration.class]: Unsatisfied dependency expressed through method 'daoAuthenticationProvider' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService': Unsatisfied dependency expressed through method 'setUserService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ipayso.services.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
  2. 03:35:05,193 INFO [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] (ServerService Thread Pool -- 81) Closing JPA EntityManagerFactory for persistence unit 'default'
  3. 03:35:05,194 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 81) HHH000227: Running hbm2ddl schema export
  4. 03:35:05,196 INFO [stdout] (ServerService Thread Pool -- 81) Hibernate: drop table if exists customer cascade
  5. 03:35:05,200 INFO [stdout] (ServerService Thread Pool -- 81) Hibernate: drop table if exists private_key cascade
  6. 03:35:05,205 INFO [stdout] (ServerService Thread Pool -- 81) Hibernate: drop table if exists public_key cascade
  7. 03:35:05,208 INFO [stdout] (ServerService Thread Pool -- 81) Hibernate: drop table if exists user_login cascade
  8. 03:35:05,211 INFO [stdout] (ServerService Thread Pool -- 81) Hibernate: drop sequence hibernate_sequence
  9. 03:35:05,213 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 81) HHH000230: Schema export complete
  10. 03:35:05,223 WARN [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 81) Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)
  11. 03:35:05,262 WARN [org.jboss.modules] (ServerService Thread Pool -- 81) Failed to define class org.springframework.boot.autoconfigure.data.rest.SpringBootRepositoryRestConfigurer in Module "deployment.devipayso-1.0.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestConfigurer (Module "deployment.devipayso-1.0.war:main" from Service Module Loader): org/springframework/data/rest/webmvc/config/RepositoryRestConfigurerAdapter
  12.  
  13. ***************************
  14. APPLICATION FAILED TO START
  15. ***************************
  16.  
  17. Description:
  18.  
  19. Parameter 0 of method setUserService in com.ipayso.services.security.UserDetailsServiceImpl required a bean of type 'com.ipayso.services.UserService' that could not be found.
  20.  
  21.  
  22. Action:
  23.  
  24. Consider defining a bean of type 'com.ipayso.services.UserService' in your configuration.
  25.  
  26. package com.project.config
  27. @Configuration
  28. public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
  29.  
  30. private AuthenticationProvider authenticationProvider;
  31.  
  32. @Autowired
  33. @Qualifier("daoAuthenticationProvider")
  34. public void setAuthenticationProvider(AuthenticationProvider authenticationProvider) {
  35. this.authenticationProvider = authenticationProvider;
  36. }
  37.  
  38. @Bean
  39. public PasswordEncoder passwordEncoder(StrongPasswordEncryptor passwordEncryptor){
  40. PasswordEncoder passwordEncoder = new PasswordEncoder();
  41. passwordEncoder.setPasswordEncryptor(passwordEncryptor);
  42. return passwordEncoder;
  43. }
  44.  
  45. @Bean
  46. public DaoAuthenticationProvider daoAuthenticationProvider(PasswordEncoder passwordEncoder, UserDetailsService userDetailsService){
  47. DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
  48. daoAuthenticationProvider.setPasswordEncoder(passwordEncoder);
  49. daoAuthenticationProvider.setUserDetailsService(userDetailsService);
  50. return daoAuthenticationProvider;
  51. }
  52.  
  53. @Autowired
  54. public void configureAuthManager(AuthenticationManagerBuilder authenticationManagerBuilder){
  55. authenticationManagerBuilder.authenticationProvider(authenticationProvider);
  56. }
  57.  
  58. @Override
  59. protected void configure(HttpSecurity httpSecurity) throws Exception {
  60. httpSecurity
  61. .authorizeRequests().antMatchers("/", "/home", "/login", "/signup").permitAll()
  62. .and()
  63. .formLogin()
  64. .loginPage("/login")
  65. .failureUrl("/login-error")
  66. .and()
  67. .logout()
  68. .logoutSuccessUrl("/home");
  69. }
  70. }
  71.  
  72. package com.project.service.security
  73. @Service("userDetailsService")
  74. public class UserDetailsServiceImpl implements UserDetailsService {
  75.  
  76. private UserService userService;
  77. private Converter<User, UserDetails> userUserDetailsConverter;
  78.  
  79. @Autowired
  80. @Qualifier(value = "userService")
  81. public void setUserService(UserService userService) {
  82. this.userService = userService;
  83. }
  84.  
  85. @Autowired
  86. @Qualifier(value = "userToUserDetails")
  87. public void setUserUserDetailsConverter(Converter<User, UserDetails> userUserDetailsConverter) {
  88. this.userUserDetailsConverter = userUserDetailsConverter;
  89. }
  90.  
  91. @Override
  92. public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
  93. return userUserDetailsConverter.convert(userService.findByEmail(email));
  94. }
  95. }
  96.  
  97. package com.project.service
  98. @Service
  99. @Profile("springdatajpa")
  100. public class UserServiceImpl implements UserService{
  101.  
  102. private UserRepository userRepository;
  103.  
  104. @Autowired
  105. public void setUserRepository(UserRepository userRepository) {
  106. this.userRepository = userRepository;
  107. }
  108.  
  109. private EncryptionService encryptionService;
  110.  
  111. @Autowired
  112. public void setEncryptionService(EncryptionService encryptionService) {
  113. this.encryptionService = encryptionService;
  114. }
  115.  
  116.  
  117. @Override
  118. public List<?> listAll() {
  119. List<User> users = new ArrayList<>();
  120. userRepository.findAll().forEach(users::add); //fun with Java 8
  121. return users;
  122. }
  123.  
  124. @Override
  125. public User getById(Integer id) {
  126. return userRepository.findOne(id);
  127. }
  128.  
  129. @Override
  130. public User saveOrUpdate(User domainObject) {
  131. if(domainObject.getPassword() != null){
  132. domainObject.setEncryptedPassword(encryptionService.encryptString(domainObject.getPassword()));
  133. }
  134. return userRepository.save(domainObject);
  135. }
  136. @Override
  137. @Transactional
  138. public void delete(Integer id) {
  139. userRepository.delete(id);
  140. }
  141.  
  142. @Override
  143. public User findByEmail(String email) {
  144. return userRepository.findByEmail(email);
  145. }
  146. }
  147.  
  148. package com.project.config
  149. @Configuration
  150. public class CommonBeanConfig {
  151.  
  152. @Bean
  153. public StrongPasswordEncryptor strongEncryptor(){
  154. StrongPasswordEncryptor encryptor = new StrongPasswordEncryptor();
  155. return encryptor;
  156. }
  157. }
  158.  
  159. package com.project
  160. @SpringBootApplication
  161. public class App extends SpringBootServletInitializer{
  162.  
  163. public static void main(String[] args) {
  164. SpringApplication.run(applicationClass, args);
  165. }
  166.  
  167. @Override
  168. protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  169. return application.sources(applicationClass);
  170. }
  171.  
  172. private static Class<App> applicationClass = App.class;
  173. }
  174.  
  175. package com.project.config
  176. @Configuration
  177. @EnableAutoConfiguration
  178. @EntityScan(basePackages = {"com.ipayso.model"})
  179. @EnableJpaRepositories(basePackages = {"com.ipayso.repositories"})
  180. @EnableTransactionManagement
  181. public class RepositoryConfiguration {
  182.  
  183. }
  184.  
  185. @Autowired
  186. @Qualifier(value = "userService")
  187. public void setUserService(UserService userService) {
  188. this.userService = userService;
  189. }
Add Comment
Please, Sign In to add comment