所以我有这个 bean 用于数据库管理。我用以下方式定义它:
<bean id="dbmanager" class="rpg.commons.database.DBManager" scope="request"/>
然后我尝试将其放入控制器中
@Controller
public abstract class AbstractController {
@EJB
protected DBManager dbmanager;
...
}
我也尝试了@Autowired,但在每种情况下,当我尝试在我的 glassfish 服务器上部署它时,我都会收到以下异常
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homePageController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected rpg.commons.database.DBManager rpg.web.controllers.AbstractController.dbmanager; nested exception is java.lang.UnsupportedOperationException
homePageController 是一个简单的控制器,它继承了我的 AbstractController。我也尝试将字段更改为公开,但它没有改变任何东西......