<repo_name>tivonY/Demo<file_sep>/test/src/main/java/com/tivon/server/aop4/TestMain4.java
package com.tivon.server.aop4;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.tivon.server.aop2.IUserDao;

public class TestMain4 {

//	<!-- 定义被代理者 -->
//	<bean id="userDao" class="com.tivon.server.aop.UserDao"></bean>
//	<bean id="myAspect" class="com.tivon.server.aop3.LoginHelper"></bean>
//
//	<aop:config>
//		<aop:pointcut id="loginHelpers" expression="execution(* *.login(..))" />
//		<aop:aspect ref="myAspect">
//			<aop:before pointcut-ref="loginHelpers" method="beforeLogin" />
//			<aop:after pointcut-ref="loginHelpers" method="afterLogin" />
//		</aop:aspect>
//	</aop:config>
	public static void main(String[] args) {
        ApplicationContext appCtx = new FileSystemXmlApplicationContext("application.xml"); 
		IUserDao userDao = (IUserDao) appCtx.getBean("userDao");
		userDao.login();
	}
}
<file_sep>/test/src/main/java/com/tivon/server/ioc3/PhoneCall.java
package com.tivon.server.ioc3;

public interface PhoneCall {
	
	public void responseCall(String mess);
}
<file_sep>/test/src/main/java/com/tivon/server/ioc2/User.java
package com.tivon.server.ioc2;


public class User {
	
	public void testResponseCall() {

		PhoneCall call = new AndroidPhone();   
		call.responseCall(" i am android phone");
	}
}
<file_sep>/test/src/main/java/com/tivon/server/aop/Test.java
package com.tivon.server.aop;

public class Test {

//	AOP 资料：
//	http://blog.csdn.net/h_xiao_x/article/details/72774496
//	https://www.jianshu.com/p/f51bdde15191
//	https://www.cnblogs.com/gaopeng527/p/5290997.html
	
	
	
	
}
<file_sep>/test/src/main/java/com/tivon/server/ioc3/Director.java
package com.tivon.server.ioc3;

public class Director {

	public void direct() {
		
	   PhoneCall phoneCall = new AndroidPhone();  
       User user = new User();  
  
        //①调用属性Setter方法注入  
       user.setPhoneCall(phoneCall);   
       user.responseCall();
	}

}
<file_sep>/test/src/main/java/com/tivon/server/test/SampleController.java
package com.tivon.server.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller 
@EnableAutoConfiguration
public class SampleController {

    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }

    @RequestMapping(value = "/greeting")
    public ModelAndView test(ModelAndView mv) {
        mv.setViewName("/fragments");
        mv.addObject("title","欢迎使用Thymeleaf!");
        return mv;
    }
    
    @RequestMapping(value = "/main")
    public ModelAndView main(ModelAndView mv) {
        mv.setViewName("/view/main");
        mv.addObject("title","欢迎使用Thymeleaf!");
        return mv;
    }
    
    @RequestMapping(value = "/login")
    public ModelAndView login(ModelAndView mv) {
        mv.setViewName("/view/login.html");
        mv.addObject("title","欢迎使用Thymeleaf!");
        return mv;
    }
    
    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);
    }
}
<file_sep>/test/src/main/java/com/tivon/server/ioc/User.java
package com.tivon.server.ioc;

public class User {
	
	public void testResponseCall() {
		
		AndroidPhone phone = new AndroidPhone();
		phone.responseCall(" i am android phone");
	}
}
<file_sep>/test/src/main/java/com/tivon/server/ioc4/Test.java
package com.tivon.server.ioc4;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Test {
	
	public static void main(String[] args) {
//		http://www.importnew.com/14751.html
		
//	    <!--IOC ①实现类实例化-->
//	    <bean id="geli" class="com.tivon.server.ioc4.LiuDeHua"/>
//	    <!--②通过geli-ref建立依赖关系-->
//	    <bean id="moAttack" class="com.tivon.server.ioc4.MoAttack">
//	    		<property name="geli" ref="geli"/>  
//	    </bean>

        ApplicationContext appCtx = new FileSystemXmlApplicationContext("application.xml"); 
        User user = (User) appCtx.getBean("moAttack");
        user.responseCall();
        
	}

}
<file_sep>/test/src/main/java/com/tivon/server/sql/SqlMain.java
package com.tivon.server.sql;

public class SqlMain {

	
	public static void main(String[] args) {
		
		//sql server
		//uuid : newid();
		//1.修改表字段：ALTER TABLE t_user ALTER COLUMN upass VARCHAR(255);
		//2.datetime and datetime2 ： datetime2精确度高； 
		//3.datetimeoffset - 时区
		//4. timestamp 是二进制数字，它表明数据库中数据修改发生的相对顺序;最初是为了支持 SQL Server 恢复算法
		
		
	}
	
}
<file_sep>/test/src/main/java/com/tivon/server/aop2/TestMain2.java
package com.tivon.server.aop2;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class TestMain2 {
//	
//
//	<!-- 定义被代理者 -->
//<!-- 	<bean id="userDao" class="com.tivon.server.aop.UserDao"></bean> -->
//
//	<!-- 定义通知内容，也就是切入点执行前后需要做的事情 -->
//	<!-- <bean id="loginHelper" class="com.tivon.server.aop.LoginHelper"></bean> -->
//
//	<!-- 定义切入点位置 -->
//	<!-- <bean id="loginPointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut">
//		<property name="pattern" value=".*login"></property>
//	</bean> -->
//
//	<!-- 使切入点与通知相关联，完成切面配置 -->
//	<!-- <bean id="loginHelperAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
//		<property name="advice" ref="loginHelper"></property>
//		<property name="pointcut" ref="loginPointcut"></property>
//	</bean> -->
//
//	<!-- 设置代理 -->
//	<!-- <bean id="proxy" class="org.springframework.aop.framework.ProxyFactoryBean">
//		代理的对象，有睡觉能力
//		<property name="target" ref="userDao"></property>
//		使用切面
//		<property name="interceptorNames" value="loginHelperAdvisor"></property>
//		代理接口，睡觉接口
//		<property name="proxyInterfaces" value="com.tivon.server.aop.IUserDao"></property>
//	</bean> -->
//	
	//https://blog.csdn.net/zhangliangzi/article/details/52334964
	public static void main(String[] args) {
        //AOP : Aspect Oriented Program
		
		
		//aspectjweaver
		//aspectjrt
		//spring-aop
		
		
		//如果是web项目，则使用注释的代码加载配置文件，这里是一般的Java项目，所以使用下面的方式  
        ApplicationContext appCtx = new FileSystemXmlApplicationContext("application.xml");  
        IUserDao userDao = (IUserDao)appCtx.getBean("proxy");  
        userDao.login();
        
	}
	
	
}
