java - Spring classNotFound when creating spring bean -


when creating bean name usersevice, got classnotfound exception. i'm using spring web-mvc , spring-security

this bean in servlet.xml

<bean id="userservice" class="tr.com.xxx.service.userservice"></bean> 

this class want create it's bean

public class userservice implements userdetailsservice {  @autowired private accountrepository accountrepository;  @postconstruct   protected void initialize() {     //accountrepository.save(new account("user", "demo", "role_user"));     //accountrepository.save(new account("admin", "admin", "role_admin"));     system.out.print("inside aouth"); }  @override public userdetails loaduserbyusername(string username) throws usernamenotfoundexception {     system.out.print("inside loadbyusername");     account account = accountrepository.findbyemail(username);     if(account == null) {         throw new usernamenotfoundexception("user not found");     }     return createuser(account); }  public void signin(account account) {     system.out.print("sign in");     securitycontextholder.getcontext().setauthentication(authenticate(account)); }  private authentication authenticate(account account) {     system.out.print("inside authenticate");     return new usernamepasswordauthenticationtoken(createuser(account), null, account.getauthorities()); }  private user createuser(account account) {     system.out.print("inside cu");     return new user(account); }  private static class user extends org.springframework.security.core.userdetails.user {      private final account account;      public user(account account) {         super(account.getemail(), account.getpassword(), account.getauthorities());         this.account = account;         system.out.print("inside user");     }      public account getaccount() {         return account;     }      public boolean isadmin() {         return getaccount().isadmin();     } }  } 

and error:

caused by: java.lang.classnotfoundexception: tr.com.xxx.service.userservice @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1720) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ org.springframework.util.classutils.forname(classutils.java:247) @ org.springframework.beans.factory.support.abstractbeandefinition.resolvebeanclass(abstractbeandefinition.java:395) @ org.springframework.beans.factory.support.abstractbeanfactory.doresolvebeanclass(abstractbeanfactory.java:1348) @ org.springframework.beans.factory.support.abstractbeanfactory.resolvebeanclass(abstractbeanfactory.java:1319) ... 18 more 


Comments

Popular posts from this blog

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -

How to run C# code using mono without Xamarin in Android? -