spring容器启动时候调用静态方法
<bean id="syncConfigIdStatic" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod" value="com.yb.async.domain.config.DataSyncConfig.setSyncConfigId"/> <property name="arguments" value="${dataSyncConfig.syncConfigId}"> </property> </bean>
这样调用了静态方法
============
1.事务失效解决方法
Spring MVC要想事务生效,你必须保证spring-mvc.xml的context:component-scan只扫描Controller,而 spring-config.xml里的不包含Controller. 否则你定义在spring-config.xml里的事务就要失效了。方法如下:
spring-config.xml:
<context:component-scan base-package="com.jd.etms.waybillui">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
spring-config-mvc.xml:
<context:component-scan base-package="com.jd.etms.waybillui" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
#####################################################3
方法命名规范
1.方法命名满足驼峰规则,首字母小写,动词+名词形式命名,命名具备实际意义的英文名,除非特别约定,否则尽量不用缩写;
2.基础方法:
接口与服务层:插入【create+对象】,更新【update+对象】,查详情【get+对象】,查列表【list+对象】,查总数【count+对象】;
dao层与mapper文件:插入【insert】,主键更新【updateByPrimaryKey】,主键查询详情【selectByPrimaryKey】,查列表【list】,查总数【count】;
3.自定义方法:
接口与服务层:插入【create开头】,更新【update开头】,查详情【get开头】,查列表【list开头】,查总数【count开头】;
dao层与mapper文件:插入【insert开头】,更新【update开头】,查询详情【select开头】,查列表【list开头】,查总数【count开头】。
相关推荐
spring 配置方法,xml文件,爱好ssh框架的通知们来把,spring配置事物管理,配置数据源
spring配置 spring配置 spring配置 spring配置 spring配置
Spring配置 Spring 配置 映射 加注释!!!!Spring配置 Spring 配置 映射 加注释!!!!
ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssm...
proxool配置参数说明。 spring结合proxool的datasource配置方法 及proxool-0.9.1.jar proxool-cglib.jar
spring配置文件实例
Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合
spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件...
使用Spring配置文件实现AOP
Spring声明式事务配置管理方法
Spring的基本配置Spring的基本配置Spring的基本配置Spring的基本配置Spring的基本配置Spring的基本配置Spring的基本配置
spring数据源配置
spring 配置文件 归类 IOC AOPspring 配置文件 归类 IOC AOP
服务Spring利用依赖注入机制来简化工作同时提高易测性Springbeans及依赖以及beans类所需服务都在配置 文件中进行了详细介绍说明这个配置文件是典型XML格式但是它既冗长又不实用对于需要定义大量 Springbeans大工程来...
spring配置最佳实践.zip spring配置最佳实践.zip spring配置最佳实践.zip
spring配置和启动方式 博客地址:https://blog.csdn.net/u010476739/article/details/76696756
1.创建web工程 2.导入jar ...3.导入配置文件 spring-framework-2.5.6\samples\jpetstore\war\WEB-INF\log4j.properties spring-framework-2.5.6\samples\jpetstore\war \WEB-INF\applicationContext.xml
J2EE javascrip 基础知识,MVC spring 配置
spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip ...
SpringCloud——分布式配置中心(Spring Cloud Config)之高可用的分布式配置中心