各种常用环境搭建

各种常用环境搭建

1. Java 环境
a. 系统环境变量: 新建 JAVA_HOME 为 jdk根目录
b. 系统环境变量 path : 新建 %JAVA_HOME%\bin

2. Tomcat 环境:
a. 系统环境变量: 新建 Catalina_HOME 为tomcat根目录 path中添加%Catalina_HOME%\bin\ 与%Catalina_HOME%\lib\ 路径
b. Eclipse 搭建tomcat : server–> Create new Server --> tomcat version
并双加server中的tomcat打开tomcat server设置 将server location设置为use tomcat installation
将deploy path设置为server path\webapps
c.注意,一旦修改tomcat/config/xxx.xml配置文件,必须在eclipse workspace server/core中修改对应的文件,二者必须保持一致

3. Spring beans 环境:
a. MyEclipse: myeclipse --> Add Spring Capabilities --> Spring AOP & Spring Core
b. Eclipse: 导入spring jar包全件 library + commons logging
c. (springmvc.xml/beans.xml) 配置 各种 bean 类:interceptor,entity,service类,impl类
d. WebContent/WEB-INF/web.xml 不需配置
d. 中断环绕器 interceptor:(可选)创建com.interceptor/MyInterceptor , 实现 MethodInterceptor 接口并重写invoke(MethodInvocation arg0)方法
e. 测试类
ApplicationContext context = new ClassPathXmlApplicationContext(“beans.xml”);
context.getBean(“proxyFactoryBean”);

4. Springmvc 环境:
a. MyEclipse: myeclipse --> AddSpringCapabilities --> Spring Core & Spring Web

b. Eclipse: 导入spring jar 包全件 library + jstl jar + commons-logging

c. springmvc.xml 配置:
扫描controller 于 context:component-scan标签,

配置各种bean 类:
国际化(ReloadableResourceBundleMessageSource)		
src/message_en_US.properties & src/message_zh_CN.properties
页面导入`<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>` 以使用spring:message
并且在页面浏览必须先由controller跳转至主页面

全局转换器(ConversionServiceFactoryBean)
com.converter/StrToDateConverter 继承 converter接口 增加泛型
springmvc.xml配置ConversionServiceFactoryBean 与mvc:annotation-driven

视图解析器(UrlBasedViewResolver)

d. web.xml 配置: eclipse 配置web.xml 可能需要加 <absolute-ordering\> 标签
并加入<servlet> and <servlet-mapping> 标签
<servlet>标签中加入<init-param> 关联springmvc.xml标签

      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:springmvc.xml</param-value>

5. MyBatis环境
a. 导入mybatis jar
b. 编写mybatis-config.xml核心配置文件(在mybatis reference doc中得到xml头文件)
c. 编写jdbc.properties 并注册在mybatis-config.xml <properties>标签中
d. 创建entity 类 属性符合数据库表字段
e. 创建dao层接口 编写各种sql方法
f. 创建com.mapper/xxxMapper.xml 映射sql文件 id与接口方法相同 并将其注册在mybatis-config.xml
<mappers>标签中
g. 创建MyBatisUtil 类并使用静态代码块读取配置文件,创建Factory对象,写openSession & closeSession方法
h. 测试类中创建调用MyBatisUtil创建SqlSession并进行操作

6.数据库环境
a. MySQL数据库: MYSQL_HOME: MySQL server version\bin 目录
b. Oracle数据库: ORACLE_HOME: product\version\dbhome_1 目录
oracle_sid: orcl (实例名)

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值