java - HTTP Status 500 - Servlet.init() for servlet spring threw exception here is my code -
controller,service , dao in different package userser interface , userservice class on package com.service userda interface , userdao class on package com.dao , controller on package com.controller please me , if doing on same package working different package not working
thankyou
@controller public class usercontroller { @autowired public userser userser; @requestmapping(value="/get") public void dummytest() { system.out.println(userser.sayhii()); } } @service("userser") public class userservice implements userser{ @autowired public userda userda; public string sayhii() { return userda.say(); } } @repository("userda") public class userdao implements userda { public string say() { return "hiiiiiiiiiiiii"; } } web.xml * <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>* spring-servlet.xml *<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:ctx="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd "> <ctx:annotation-config></ctx:annotation-config> <mvc:annotation-driven/> <ctx:component-scan base-package="com.controller"></ctx:component-scan> <bean class="org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping" /> <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/views/" /> <property name="suffix" value=".jsp" /> </bean> </bean>*
Comments
Post a Comment