Questions about Spring MVC not going to roll

Source: Internet
Author: User

Configuration is the normal configuration

I'm not going to stick it out.

The key is the automatic injection of service packs

Be sure to scan in the parent container , or the transaction cannot be rolled back

The so-called parent container

Spring and spring MVC are a little different

Simply speaking, spring is the parent container.

Spring MVC is a sub-container (may not be appropriate)

Other words

<!--service Pack (auto-inject)--><context:component-scan base-package= "Demo.service"/>

Put it in Applicationcontext.xml if you put it in Springmvc.xml, the transaction will be problematic. Transactions that are not scanned by the parent container will not be rolled back


 <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <conte Xt-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:/config/ Applicationcontext.xml</param-value> <!--parent container--</context-param> <filter> <description& gt; Character Set filters </description> <filter-name>encodingFilter</filter-name> <filter-class> Org.springframework.web.filter.characterencodingfilter</filter-class> <init-param> <description& gt; Character set encoding </description> <param-name>encoding</param-name> <param-value>utf-8</param-va lue> </init-param> </filter> <filter-mapping> <filter-name>encodingfilter</filter-na me> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <description>sprin G Listener </description> &LT;LISTENER-CLASS&GT;org.springframework.web.context.contextloaderlistener</listener-class> </listener> <listener > <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </ listener> <servlet> <servlet-name>SpringMVC</servlet-name> <servlet-class> Org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <description> Spring MVC configuration file </description> <param-name>contextConfigLocation</param-name> <param-value& Gt;classpath:/config/spring-mvc.xml</param-value><span style= "FONT-SIZE:24PX;" ><!--Sub-containers--></span> </init-param> <load-on-startup>1</load-on-startup> &LT;/SERVL Et>


Questions about Spring MVC not going to roll

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.