wangmengqiang001 / spring-feature

test feature of various versions of spring and hibernate
0 stars 0 forks source link

Dependency Inject POJO #5

Closed wangmengqiang001 closed 5 years ago

wangmengqiang001 commented 5 years ago

create pojo in package osgi.web.beans

osgi.web.beans.Account
osgi.web.beans.ApplyApproval
osgi.web.beans.ApproveInfo
osgi.web.beans.AuditOperation
osgi.web.beans.ReportInfo

inject them in spring xml configuration

       <bean id="account" class="osgi.web.beans.Account" />
       <bean id="userinfo" class="osgi.web.beans.UserInfo" >
            <property name="account" value="Sysadmin"/>
            <property name="password" value="adminpassword"/>
       </bean>
       <bean id="operator" class="osgi.web.beans.UserInfo" >
            <property name="account" value="OperatorUser"/>
            <property name="password" value="ops_password"/>
       </bean>
       <bean id="reportinfo" class="osgi.web.beans.ReportInfo"/>
wangmengqiang001 commented 5 years ago

issues

  1. beans.xml was located in src/spring-config, but it cannot be packed into war during building.
  2. failed to inject bean to servlet by @Configurable

findings

  1. Either annotation @Controller or Interface Control can be used to define the controller class.
  2. The return type of controller can be String(view name),ModelView, Object,or collections。 The annotation @ResponseBody is used to define it as rest api.