VS2017 MVC Spring net 环境配置
首先打开管理NuGet程序包。
搜索 "spring web",安装Spring.Web,Spring.Web.Mvc5,Spring.Web.Extensions,
搜索Microsoft.AspNet.WebApi,安装,这个一定要安装,不然会报错:找不到依赖项。
安装完成后,配置Web.Config文件
代码如下
<!--Sping.net配置-->
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.MvcContextHandler, Spring.Web.Mvc5" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<!--容器配置-->
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<!--这里放容器里面的所有节点-->
<description>An example that demonstrates simple IoC features.</description>
<!--<object name="LinkDal" type="Zero.Cmsqc.EFDAL.LinkDal, Zero.Cmsqc.EFDAL" singleton="false" >
</object>--> <object name="DbSession" type="Zero.Cmsqc.DALFactory.DbSessionFactory, Zero.Cmsqc.DALFactory" singleton="false" factory-method="GetCurrentDbSession" >
</object>
<object name="LinkDal" type="Zero.Cmsqc.EFDAL.LinkDal, Zero.Cmsqc.EFDAL" singleton="false" >
</object>
<object name="LinkService" type="Zero.Cmsqc.BLL.LinkService, Zero.Cmsqc.BLL" singleton="false" >
<property name="DbSession" ref="DbSession"/>
<property name="CurrentDal" ref="LinkDal"/>
</object>
<object type="Zero.Cmsqc.UI.Controllers.LinkController, Zero.Cmsqc.UI" singleton="false" >
<property name="LinkService" ref="LinkService"/>
</object> </objects>
</spring>
再修改 Global.asax 文件,让MvcApplication继承SpringMvcApplication,
using Spring.Web.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing; namespace Zero.Cms.UI
{
public class MvcApplication : SpringMvcApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
到这里配置工作 就完成了!
VS2017 MVC Spring net 环境配置的更多相关文章
- Spring MVC 学习总结(一)——MVC概要与环境配置 转载自【张果】博客
Spring MVC 学习总结(一)--MVC概要与环境配置 目录 一.MVC概要 二.Spring MVC介绍 三.第一个Spring MVC 项目:Hello World 3.1.通过Mave ...
- spring boot 环境配置(profile)切换
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...
- [教程] Spring+Mybatis环境配置多数据源
一.简要概述 在做项目的时候遇到需要从两个数据源获取数据,项目使用的Spring + Mybatis环境,看到网上有一些关于多数据源的配置,自己也整理学习一下,然后自动切换实现从不同的数据源获取数据功 ...
- Spring MVC 学习总结(一)——MVC概要与环境配置
一.MVC概要 MVC是模型(Model).视图(View).控制器(Controller)的简写,是一种软件设计规范,用一种将业务逻辑.数据.显示分离的方法组织代码,MVC主要作用是降低了视图与业务 ...
- Spring MVC 学习总结(八)——Spring MVC概要与环境配置(IDEA+Maven+Tomcat7+JDK8、示例与视频)
一.MVC概要 MVC是模型(Model).视图(View).控制器(Controller)的简写,是一种软件设计规范,用一种将业务逻辑.数据.显示分离的方法组织代码,MVC主要作用是降低了视图与业务 ...
- Spring MVC 学习总结(一)——MVC概要与环境配置(IDea与Eclipse示例)
一.MVC概要 MVC是模型(Model).视图(View).控制器(Controller)的简写,是一种软件设计规范,用一种将业务逻辑.数据.显示分离的方法组织代码,MVC主要作用是降低了视图与业务 ...
- [Spring]01_环境配置
)在资源库界面点击Artifacts标签,然后点击libs-release-local,展开后依次点击org -> springframework -> spring.
- spring boot环境配置以及开发工具选择(Spring一)
首先安装java jdk jdk的安装参考:https://blog.csdn.net/zhys0902/article/details/79499329配置效果如下: 接下来是maven的相关配置 ...
- ASP.NET MVC 5 开发环境配置
Install-Package Ninject -Version 3.2.2 -ProjectName SportsStore.WebUIInstall-Package Ninject.Web.Com ...
随机推荐
- Redis4.0 之持久化存储
redis如果提供缓存服务,可以关闭所有持久化存储,如此一来redis重启后所有数据会丢失 开启rdb或aof持久化存储,能把redis中的数据持久化到磁盘中. rdb和aof对性能都有影响,所以建议 ...
- 集合 set
集合 集合属于可变数据类型,但它的内容必须是不可变数据类型. 特点:无序 , 不重复 有两种创建方式: set({1,2,3})和 {1,2,3} set1 = set({1,2,3,4}) s ...
- git for linux使用
1 Linux下Git和GitHub环境的搭建 第一步: 安装Git,使用命令 “sudo apt-get install git” 第二步: 创建GitHub帐号 第三步: 生成ssh key,使用 ...
- mondodb和mysql的区别
我想从安全性和数据量这两个方面进行阐述. mongodb与mysql命令对比 传统的关系数据库一般由数据库(database).表(table).记录(record)三个层次概念组成, MongoDB ...
- Entity framework 绑定到Datagridview的添加删除修改
Entity framework 绑定到Datagridview的添加删除修改 using System; using System.Collections.Generic; using System ...
- PHP百度AI的OCR图片文字识别
第一步可定要获取百度的三个东西 要到百度AI网站(http://ai.baidu.com/)去注册 然后获得 -const APP_ID = '请填写你的appid'; -const API_KEY ...
- Qt文档阅读笔记-QGraphicsItem::paint中QStyleOptionGraphicsItem *option的进一步认识
官方解析 painter : 此参数用于绘图;option : 提供了item的风格,比如item的状态,曝光度以及详细的信息:widget : 想画到哪个widget上,如果要画在缓存区上,这个参数 ...
- vuex store刷新存储状态
app.vue 平时不想把信息存到session里,只有无可奈何的时候才准备村 <script> export default { name: 'App', created() { //刷 ...
- Haproxy官方文档翻译(第二章)配置Haproxy 附英文原文
2.配置 HAProxy 2.1 配置文件格式 Haproxy的配置过程包含了3部分的参数资源:- 命令行中的参数,此种参数总是享有优先权被使用- 配置文件中global节点中的参数,此种参数是进程范 ...
- iOS日历控件
项目需要,前一阵子重构了下iPad工程,添加了一个滚动无缝日历. 当时没有头绪,网上找了一个源码改吧改吧就上线了(参考链接),这个功能很多而且流畅性也特别好,推荐不会写的可以参考下. 这几天,活不太忙 ...