applicationcontext.xml和spring-servlet.xml怎么配置

2024-12-01 08:04:34
推荐回答(2个)
回答1:

spring-servlet.xml是说springmvc吗?

这些都需要看你具体用到了什么来进行具体配置的.

给你一个参考吧:

spring-servlet.xml的:


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
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
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc.xsd   
    http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-4.1.xsd"
default-lazy-init="true">












class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">


text/html;charset=UTF-8
text/json;charset=UTF-8
application/json;charset=UTF-8




class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">


    




class="org.springframework.web.servlet.view.InternalResourceViewResolver">
value="org.springframework.web.servlet.view.JstlView" />






class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">















class="org.springframework.web.multipart.commons.CommonsMultipartResolver">











application.xml


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd   
    http://www.springframework.org/schema/context   
    http://www.springframework.org/schema/context/spring-context-4.1.xsd  
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
    http://www.springframework.org/schema/task 
    http://www.springframework.org/schema/task/spring-task-4.1.xsd     
    http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-4.1.xsd"
     default-lazy-init="false"> 
 























回答2:


        
    
    
    
    
    
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        
    

            destroy-method="close">
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    

    
    
        
        
        
        
        
    

    
    
        
        
    

    
            class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        
    
    
    

spring 的


    
    
    
            class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
        
            
                text/html;charset=UTF-8
            

        
    
    
            class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        
            
                 
            

        
    
    
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        
        
        
    
    
    
            class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        
        
        
        
        
        
    
Springmvc的