eclipse - Vaadin7 with mybatis and Spring -


i new vaadin , mybatis-spring.

my ui class not invoke service class using @autowired annotation. have appended @service service class.

my view:

@suppresswarnings("serial") @theme("test") @component @scope("prototype") @springview(name = testui.id) public class testui extends ui {      @webservlet(value = "/*", asyncsupported = true)     @vaadinservletconfiguration(productionmode = false, ui = testui.class)     public static class servlet extends vaadinservlet {     } @autowired      userservice service;         usermodel model; 

my application context.xml under resources folder.

<ct:annotation-config/> <ct:component-scan base-package="com.example.test" /> <ct:component-scan base-package="com.example.service" /> <ct:component-scan base-package="com.example.model" /> <ct:component-scan base-package="com.example.mapper" /> 

devcontext.xml

<context:annotation-config /> <bean id="devdatasource" destroy-method="close"     class="org.apache.commons.dbcp.basicdatasource">     <property name="driverclassname" value="oracle.jdbc.driver.oracledriver" />     <property name="url"         value="" />     <property name="" value="" />     <property name="" value="" />     <property name="" value="" />     <property name="maxactive" value="50" />     <property name="validationquery" value="select 1 dual"/>     <property name="testonborrow" value="true"/>     <property name="connectioninitsqls">         <list>             <value>alter session set current_schema=null</value>         </list>     </property> </bean>  <!-- setup mybatis bean --> <bean id="sqlsessionfactory" class="org.mybatis.spring.sqlsessionfactorybean">     <property name="datasource" ref="devdatasource" />     <property name="configlocation" value="classpath:mybatis-config.xml" /> </bean>  <bean id="usermapper" class="org.mybatis.spring.mapper.mapperfactorybean">     <property name="mapperinterface" value="com.example.mapper.mapper" />     <property name="sqlsessionfactory" ref="sqlsessionfactory" /> </bean>  <!-- automatically find mappers --> <bean class="org.mybatis.spring.mapper.mapperscannerconfigurer">     <property name="basepackage" value="com.example.mapper.**.mapper" /> </bean> 

servicedevcontext.xml

<context:component-scan base-package="com.example"></context:component-scan> 

web.xml

<context-param>     <param-name>contextconfiglocation</param-name>     <param-value>classpath*:resources/applicationcontext.xml</param-value> </context-param>  <context-param>     <param-name>contextclass</param-name>     <param-value>            org.springframework.web.context.support.annotationconfigwebapplicationcontext     </param-value> </context-param> <listener>     <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener>  <listener>     <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class> </listener> 

the code not working, kindly me figure out missed

try use @springui instead of @springview on ui subclass, , need use springvaadinservlet instead of vaadinservlet, best remove static servlet class inherits vaadinservlet, , spring addon use correct servlet instead.

i recommend rid of xml-config, unless happen it. using spring boot vaadin supported on start.spring.io, it's pretty easy way bootstrap project files , config.


Comments