Spring.net页面属性注入

1.条件spring.web程序集
1.1 system.web配置
<httpHandlers>
      <add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
</httpHandlers>
1.2 httpModules配置
<httpModules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
</httpModules>
1.3 system.webserver配置
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
    </modules>
    <handlers>
      <add name="SpringPageHandler" verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory,
 Spring.Web"/>
      <add name="SpringContextMonitor" verb="*" path="ContextMonitor.ashx" type="Spring.Web.Support.ContextMonitor,
 Spring.Web"/>
    </handlers>
  </system.webServer>1.4 spring xml配置 注意type要写web的文件路径否则会出错,网站大多是抄的,所以都只有一个Default.aspx,这里要特别注意否则功亏一篑

<object type="~/admin/Sys/SysDictTypeEdit.aspx">
<property name="Psvc" ref="SysDictTypeService"/>

</object>

<object id="SysDictTypeService" type="Bll.SysDictTypeService, HRABLL">
<property name="Dao" ref="CommonService"/>
<property n

1.5 页面放个属性就好了

private Contract.IService.ISysDictTypeService psvc;
/// <summary>
/// 初始化
/// </summary>
public Contract.IService.ISysDictTypeService Psvc
{
get;set;

}

时间: 2024-08-28 18:34:23

Spring.net页面属性注入的相关文章

Spring笔记②--各种属性注入

Ioc 反转控制 反转资源获取的方向 分离接口与实现 采用工厂模式 采用反转控制 ? Di 依赖注入 依赖容器把资源注入 ? 配置bean 通过全类名(反射) 配置形式:基于xml方式 Ioc容器的beanFactory&ApplicationContext 依赖注入的方式:属性注入,构造器注入 ? ? Bean必须要有一个无参的构造函数 Class:bean的全类名,通过反射的方式在IOC容器中创建bean,所以要求bean中必须有无参的构造函数 id :bean 的标示,id唯一 ? app

spring学习之属性注入

首先准备工作 本项目的目录结构如下: spring中属性的相互关系是通过applicationContext.xml来管理的,spring提倡面向接口的编程,因此在dao层使用接口抽象方法. 下面是各层的代码: public interface StudentsDAO { //保存学生 public boolean saveStudents(Students s); } 接口的实现类. public class StudentsDAOImpl implements StudentsDAO { @

Spring框架笔记(三)——Spring容器、属性注入和构造器注入详解

Spring 容器 在 Spring IOC 容器读取 Bean 配置创建 Bean 实例之前, 必须对它进行实例化. 只有在容器实例化后, 才可以从 IOC 容器里获取 Bean 实例并使用. Spring 提供了两种类型的 IOC 容器实现. BeanFactory: IOC 容器的基本实现. ApplicationContext: 提供了更多的高级特性. 是 BeanFactory 的子接口. BeanFactory 是 Spring 框架的基础设施,面向 Spring 本身: Appli

spring HibernateDaoSupport 注解属性注入的方法

/*使用注解属性注入无法调用HibernateDaoSupport中的setSessionFactory方法,需要手动创建,并且setSessionFactory不能被重写 * 需要新建方法,在新方法中调用父类的setSessionFactory方法,显式的指向属性名称*/ @Resource(name="sessionFactory") private void setSF(SessionFactory sessionFactory) { setSessionFactory(sess

Spring中的属性注入注解

@Inject使用 JSR330规范实现的 默认按照类型注入 如果需要按照名称注入,@Inject需要和@Name一起使用 @Resource JSR250规范实现的,需要导入不同的包 @Resource是按照名称匹配的 @Autowired Spring中定义的注解 默认按照类型注入 如果需要按照名称注入,需要配合@Qualifier注解一起使用 包含一个require属性 原文地址:https://www.cnblogs.com/watertreestar/p/11780306.html

【Java Web开发学习】Spring构造器和属性注入

测试类 public class Construct { private String address; private long phone; public Construct(String name, int age) { System.out.println("> " + name + ", " + age); } public String getAddress() { return address; } public void setAddress(

Spring static 静态属性注入

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod" value="**.service.utils.PostUtil.setEnableValidateMode"/> <property name="arguments">

spring-boot实战【05】:Spring Boo多环境配置及配置属性注入到对象

项目工程结构: 配置文件application.properties文件 com.yucong.blog.name=yucong com.yucong.blog.title=Spring Boot Course com.yucong.blog.desc=${com.yucong.blog.name} is learing ${com.yucong.blog.title} # 随机字符串 com.yucong.blog.value=${random.value} # 随机int com.yucon

spring学习一——基本搭建,属性注入的两种方式

今天用spring 3.2.5搭建了基本的环境,spring出的太快了,前段时间才3.2.5,今儿个一瞧已经上了4的版本了,稍后给出spring的jar下载地址,毕竟现在官网上找不到了啊. 废话少说了,spring 3.2.5已经将所有的依赖包都放在了dist的lib下面,并且都有doc包和源码包,很是方便.先导入所需的jar包:core,context,beans,expression 四个jar包,除此之外,还需导入commons-logging. 下一步,新建xml文件,建议名称为 app