ssh1

概念
ssh
:linux远程访问授权
:Struts spring hibernate
类要加get和set
:spring-webmvc spring-ioc hibernate
ssm/ssi
:Struts spring mybatis3.0(ibatis2.0)
:spring-webmvc spring-ioc mybatis3.0(ibatis2.0)

插件
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>


spring框架环境
普通参数
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="com.yvdedu.testmaven.ml.A" />


<bean class="com.yvdedu.testmaven.ml.A" scope="singleton">
scope默认为singleton单例,prototype原型,决定类A创建一个还是多个
<property name="url" value="jdbc:mysql://xx"/>
</bean>

private Properties cfgs;
<property name="cfgs>
<props>
<prop key="jdbc" >abc</prop>
<prop key= "user" >root</prop>
<props>
<property>

<property name= "cfgs">
<value>
url=jdbc:mysql://xx
user=root
</value>
</property>
</beans>

类参数
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean class="com.yvdedu.testmaven.ml.A">
<property name="c" ref="c"/>
</bean>
<bean id="c" class="com.yvdedu.testmaven.m2.C">
</bean>
</beans>
依赖
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.9.RELEASE</version>
</dependency>
</dependencies>

调用类
ApplicationContext context = new ClassPathXmlApplication(“applicationContext.xml");
context.getBen(A.class).hello();

创建一个jdbc.properties文件
url=jdbc:mysql://xx
user=root

原文地址:https://www.cnblogs.com/xiao-c-s/p/12419671.html