コード@Inject
はあるクラスでは機能しますが、他のクラスでは機能しません。これが私のコードです:
- context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
">
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver"></bean>
<context:component-scan base-package="com.myfashions.services"/>
<context:component-scan base-package="com.myfashions.dao"/>
</beans>
- SellerRetriever.java
public class SellerRetriever {
@Inject
UserDAO userDAO;
...
...
}
UserDAO
クラスはcom.myfashions.dao
パッケージに存在します。
@Inject
Seller.java で動作していません。何か理由は?