├── pom.xml ├── spring-2019-01-30-0.log ├── spring-source-web.iml ├── spring.log ├── src └── main │ ├── java │ └── com │ │ └── zhuguang │ │ └── jack │ │ ├── App.java │ │ ├── ApplicationListenerTest.java │ │ ├── CorsFilter.java │ │ ├── InstantiationAwareBeanPostProcessorTest.java │ │ ├── MyApplicationListener.java │ │ ├── SmartFactoryBeanTest.java │ │ ├── annotation │ │ ├── MyAnnotationInstance.java │ │ ├── MyService.java │ │ └── TargetMethod.java │ │ ├── aop │ │ ├── TargetClass.java │ │ ├── advisorAdvice.java │ │ ├── aspect │ │ │ ├── AspectAnnotation.java │ │ │ ├── AspectXml1.java │ │ │ ├── AspectXml2.java │ │ │ └── AspectXml3.java │ │ ├── cglib │ │ │ ├── CglibBeanFactory.java │ │ │ ├── CglibCallbackFilter.java │ │ │ ├── DosomethingIntercepter1.java │ │ │ ├── DosomethingIntercepter2.java │ │ │ ├── DosomethingIntercepter3.java │ │ │ ├── FixedValueIntercepter.java │ │ │ ├── Test.java │ │ │ ├── UserService.java │ │ │ └── UserServiceImpl.java │ │ └── jdkProxy │ │ │ ├── Advice.java │ │ │ ├── Jack.java │ │ │ ├── MyTest.java │ │ │ └── People.java │ │ ├── applicationContextInitializer │ │ ├── MyApplicationContextInitializer.java │ │ └── MyApplicationContextInitializer1.java │ │ ├── aware │ │ ├── LoadTimeTest.java │ │ ├── ProfilingAspect.java │ │ ├── TargetClass.java │ │ └── Test.java │ │ ├── bean │ │ ├── ConsultConfigArea.java │ │ ├── ConsultContent.java │ │ ├── ConsultContract.java │ │ ├── ConsultIdCardInfo.java │ │ ├── ConsultRecord.java │ │ ├── ConsultRecordCount.java │ │ ├── Module.java │ │ ├── MyBeanUtils.java │ │ ├── PropertyDescriptorTest.java │ │ ├── Role.java │ │ └── User.java │ │ ├── beanDefinitionRegistryPostProcessor │ │ ├── MyBeanDefinitionRegistryPostProcessor.java │ │ └── MyBeanFactoryPostProcessor.java │ │ ├── cache │ │ ├── MongodbCache.java │ │ ├── MongodbCacheBean.java │ │ └── RedisCache.java │ │ ├── controller │ │ ├── BeanNameUrlController.java │ │ ├── CommonController.java │ │ ├── FileUploadController.java │ │ ├── FreemarkerController.java │ │ ├── NameController.java │ │ ├── UserController.java │ │ └── VelocityController.java │ │ ├── dao │ │ └── CommonMapper.java │ │ ├── exception │ │ └── PasswordCheckException.java │ │ ├── factoryBean │ │ └── FactoryBeanTest.java │ │ ├── handlerInterceptor │ │ ├── AuthInterceptor.java │ │ └── UserInterceptor.java │ │ ├── jdbc │ │ ├── ConnectionUtil.java │ │ ├── JDBCSavePointTest.java │ │ ├── JDBCTransationTest.java │ │ └── JdbcTest.java │ │ ├── mm.aj │ │ ├── mongodb │ │ ├── MongoBase.java │ │ ├── MongoDBUser.java │ │ ├── MongoDBUserDao.java │ │ └── MongoDBUserDaoImpl.java │ │ ├── prototype │ │ ├── PrototypeTest.java │ │ ├── PrototypeTestA.java │ │ └── PrototypeTestB.java │ │ ├── redis │ │ └── RedisUtil.java │ │ ├── scope │ │ ├── CustomBeanFactoryPostProcessor.java │ │ ├── CustomScope.java │ │ ├── CustomScopeBean.java │ │ └── ScopeTest.java │ │ ├── service │ │ ├── AbstractMyService.java │ │ ├── AnnotationServiceImpl.java │ │ ├── CacheServiceImpl.java │ │ ├── MyService.java │ │ └── MyServiceImpl.java │ │ ├── servlet │ │ └── MyServlet.java │ │ ├── smtransation │ │ ├── MyService.java │ │ └── MyServiceImpl.java │ │ ├── springconfig │ │ ├── LoadProperties.java │ │ └── LoadSpring.java │ │ ├── tag │ │ ├── MongoBeanDifinitionParser.java │ │ ├── RedisBeanDifinitionParser.java │ │ ├── ServletConfigTest.java │ │ ├── TagsNamespaceHandler.java │ │ └── Test.java │ │ ├── test │ │ ├── MyTest.java │ │ ├── Test.java │ │ └── XX.java │ │ ├── testbean │ │ ├── A.java │ │ ├── B.java │ │ ├── InnerClass.java │ │ ├── ListInjectTest.java │ │ ├── Man.java │ │ ├── OriginClass.java │ │ ├── OutClass.java │ │ ├── Parent.java │ │ ├── People.java │ │ ├── ReplaceClass.java │ │ ├── ShowSixClass.java │ │ ├── Son.java │ │ ├── Student.java │ │ ├── TestBean.java │ │ ├── TestServiceImpl.java │ │ └── Woman.java │ │ └── typeConverter │ │ ├── MyPropertyEditorRegistrar1.java │ │ ├── PropertyEditorTest.java │ │ ├── StringToDateConverter.java │ │ ├── StringToObjectConverter.java │ │ ├── TypeClass.java │ │ └── TypeConverterTest.java │ ├── resources │ ├── META-INF │ │ ├── aop.txt │ │ ├── aop.xml │ │ ├── aopxml配置.txt │ │ ├── bean属性.txt │ │ ├── component-scan配置 │ │ ├── mytags.xsd │ │ ├── spring.factories │ │ ├── spring.handlers │ │ ├── spring.schemas │ │ └── springmvc中的注解.txt │ ├── config │ │ ├── core │ │ │ └── core.properties │ │ ├── freemarker │ │ │ └── freemarker.properties │ │ ├── mongodb │ │ │ └── mongodb.properties │ │ ├── redis │ │ │ └── redis.properties │ │ ├── spring │ │ │ ├── applicationContext-core.xml │ │ │ ├── spring-cache.xml │ │ │ ├── spring-dispatcher.xml │ │ │ ├── spring-freemarker.xml │ │ │ ├── spring-mongodb.xml │ │ │ ├── spring-redis.xml │ │ │ └── spring-velocity.xml │ │ └── velocity │ │ │ └── velocity.properties │ ├── logback.xml │ ├── mytest.xml │ └── xml │ │ └── commomMapper.xml │ └── webapp │ ├── WEB-INF │ ├── ftls │ │ └── home.ftl │ ├── img │ │ └── timg.jpg │ ├── jsp │ │ ├── fileUpload.jsp │ │ └── ok.jsp │ ├── vm │ │ └── home.vm │ └── web.xml │ ├── index.jsp │ └── timg.jpg └── target ├── classes ├── META-INF │ ├── bean属性.txt │ ├── mytags.xsd │ ├── spring.factories │ ├── spring.handlers │ └── spring.schemas ├── com │ └── zhuguang │ │ └── jack │ │ ├── App.class │ │ ├── applicationContextInitializer │ │ ├── MyApplicationContextInitializer.class │ │ └── MyApplicationContextInitializer1.class │ │ ├── bean │ │ ├── ConsultConfigArea.class │ │ ├── ConsultContent.class │ │ ├── ConsultContract.class │ │ ├── ConsultIdCardInfo.class │ │ ├── ConsultRecord.class │ │ ├── ConsultRecordCount.class │ │ ├── Module.class │ │ ├── Role.class │ │ └── User.class │ │ ├── dao │ │ └── CommonMapper.class │ │ ├── springconfig │ │ ├── LoadProperties.class │ │ └── LoadSpring.class │ │ ├── tag │ │ ├── MongoBeanDifinitionParser.class │ │ ├── RedisBeanDifinitionParser.class │ │ ├── TagsNamespaceHandler.class │ │ └── Test.class │ │ ├── test │ │ ├── MyTest.class │ │ └── Test.class │ │ └── testbean │ │ ├── Man.class │ │ ├── OriginClass.class │ │ ├── People.class │ │ ├── ReplaceClass.class │ │ ├── ShowSixClass.class │ │ ├── Student$1.class │ │ ├── Student.class │ │ ├── TestBean.class │ │ ├── TestServiceImpl.class │ │ └── Woman.class ├── config │ ├── core │ │ └── core.properties │ └── spring │ │ ├── applicationContext-core.xml │ │ └── spring-dispatcher.xml ├── logback.xml └── mytest.xml └── spring-source-web ├── META-INF └── MANIFEST.MF ├── WEB-INF ├── classes │ ├── META-INF │ │ ├── bean属性.txt │ │ ├── mytags.xsd │ │ ├── spring.factories │ │ ├── spring.handlers │ │ └── spring.schemas │ ├── com │ │ └── zhuguang │ │ │ └── jack │ │ │ ├── App.class │ │ │ ├── applicationContextInitializer │ │ │ ├── MyApplicationContextInitializer.class │ │ │ └── MyApplicationContextInitializer1.class │ │ │ ├── bean │ │ │ ├── ConsultConfigArea.class │ │ │ ├── ConsultContent.class │ │ │ ├── ConsultContract.class │ │ │ ├── ConsultIdCardInfo.class │ │ │ ├── ConsultRecord.class │ │ │ ├── ConsultRecordCount.class │ │ │ ├── Module.class │ │ │ ├── Role.class │ │ │ └── User.class │ │ │ ├── dao │ │ │ └── CommonMapper.class │ │ │ ├── springconfig │ │ │ ├── LoadProperties.class │ │ │ └── LoadSpring.class │ │ │ ├── tag │ │ │ ├── MongoBeanDifinitionParser.class │ │ │ ├── RedisBeanDifinitionParser.class │ │ │ ├── TagsNamespaceHandler.class │ │ │ └── Test.class │ │ │ ├── test │ │ │ ├── MyTest.class │ │ │ └── Test.class │ │ │ └── testbean │ │ │ ├── Man.class │ │ │ ├── OriginClass.class │ │ │ ├── People.class │ │ │ ├── ReplaceClass.class │ │ │ ├── ShowSixClass.class │ │ │ ├── Student$1.class │ │ │ ├── Student.class │ │ │ ├── TestBean.class │ │ │ ├── TestServiceImpl.class │ │ │ └── Woman.class │ ├── config │ │ ├── core │ │ │ └── core.properties │ │ └── spring │ │ │ ├── applicationContext-core.xml │ │ │ └── spring-dispatcher.xml │ ├── logback.xml │ └── mytest.xml ├── lib │ ├── ant-1.9.6.jar │ ├── ant-launcher-1.9.6.jar │ ├── asm-5.2.jar │ ├── aspectjrt-1.8.9.jar │ ├── c3p0-0.9.5.2.jar │ ├── cglib-3.2.5.jar │ ├── cglib-nodep-3.2.5.jar │ ├── commons-pool2-2.3.jar │ ├── fastjson-1.2.37.jar │ ├── hamcrest-core-1.3.jar │ ├── jcl-over-slf4j-1.7.21.jar │ ├── jedis-2.7.3.jar │ ├── junit-4.12.jar │ ├── log4j-1.2.16.jar │ ├── logback-classic-1.1.2.jar │ ├── logback-core-1.1.2.jar │ ├── mchange-commons-java-0.2.11.jar │ ├── mongo-java-driver-2.14.3.jar │ ├── mybatis-3.4.4.jar │ ├── mybatis-spring-1.3.1.jar │ ├── mysql-connector-java-5.1.25.jar │ ├── slf4j-api-1.7.10.jar │ ├── spring-data-commons-1.12.5.RELEASE.jar │ ├── spring-data-mongodb-1.9.5.RELEASE.jar │ ├── spring-data-mongodb-cross-store-1.9.4.RELEASE.jar │ └── spring-data-mongodb-log4j-1.9.5.RELEASE.jar └── web.xml └── index.jsp /src/main/java/com/zhuguang/jack/App.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/ApplicationListenerTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | import org.springframework.context.ApplicationEvent; 4 | import org.springframework.context.ApplicationListener; 5 | 6 | public class ApplicationListenerTest implements ApplicationListener { 7 | @Override 8 | public void onApplicationEvent(ApplicationEvent event) { 9 | /*if(event instanceof MyEvent) { 10 | 11 | }*/ 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/CorsFilter.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.http.HttpServletRequest; 5 | import javax.servlet.http.HttpServletResponse; 6 | import java.io.IOException; 7 | 8 | public class CorsFilter implements javax.servlet.Filter { 9 | @Override 10 | public void init(FilterConfig filterConfig) throws ServletException { 11 | 12 | } 13 | 14 | @Override 15 | public void doFilter(ServletRequest request, ServletResponse resp, FilterChain chain) throws IOException, ServletException { 16 | System.out.println("============CorsFilter.doFilter========="); 17 | HttpServletResponse response = (HttpServletResponse) resp; 18 | response.setHeader("Access-Control-Allow-Origin", "*"); 19 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 20 | response.setHeader("Access-Control-Max-Age", "3600"); 21 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with,Authorization"); 22 | response.setHeader("Access-Control-Allow-Credentials", "true"); 23 | chain.doFilter((HttpServletRequest)request, response); 24 | } 25 | 26 | @Override 27 | public void destroy() { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/InstantiationAwareBeanPostProcessorTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.PropertyValues; 5 | import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor; 6 | 7 | import java.beans.PropertyDescriptor; 8 | 9 | public class InstantiationAwareBeanPostProcessorTest implements InstantiationAwareBeanPostProcessor { 10 | @Override 11 | public Object postProcessBeforeInstantiation(Class beanClass, String beanName) throws BeansException { 12 | try { 13 | return beanClass.newInstance(); 14 | } catch (InstantiationException e) { 15 | e.printStackTrace(); 16 | } catch (IllegalAccessException e) { 17 | e.printStackTrace(); 18 | } 19 | return null; 20 | } 21 | 22 | 23 | @Override 24 | public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { 25 | return false; 26 | } 27 | 28 | @Override 29 | public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException { 30 | return null; 31 | } 32 | 33 | @Override 34 | public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { 35 | return null; 36 | } 37 | 38 | @Override 39 | public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/MyApplicationListener.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | import org.springframework.context.ApplicationEvent; 4 | import org.springframework.context.ApplicationListener; 5 | 6 | public class MyApplicationListener implements ApplicationListener { 7 | @Override 8 | public void onApplicationEvent(ApplicationEvent event) { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/SmartFactoryBeanTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | import org.springframework.beans.factory.SmartFactoryBean; 4 | 5 | public class SmartFactoryBeanTest implements SmartFactoryBean { 6 | @Override 7 | public boolean isPrototype() { 8 | return false; 9 | } 10 | 11 | @Override 12 | public boolean isEagerInit() { 13 | System.out.println("================>>SmartFactoryBeanTest"); 14 | return true; 15 | } 16 | 17 | @Override 18 | public Object getObject() throws Exception { 19 | return null; 20 | } 21 | 22 | @Override 23 | public Class getObjectType() { 24 | return null; 25 | } 26 | 27 | @Override 28 | public boolean isSingleton() { 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/annotation/MyAnnotationInstance.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.annotation; 2 | 3 | @MyService 4 | public class MyAnnotationInstance { 5 | public String name = "jack"; 6 | 7 | public String getName() { 8 | return this.name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/annotation/MyService.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.TYPE}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Documented 8 | public @interface MyService { 9 | 10 | /** 11 | * The value may indicate a suggestion for a logical component name, 12 | * to be turned into a Spring bean in case of an autodetected component. 13 | * @return the suggested component name, if any 14 | */ 15 | String value() default ""; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/annotation/TargetMethod.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Retention(RetentionPolicy.RUNTIME) 6 | @Target({ElementType.METHOD}) 7 | @Documented 8 | public @interface TargetMethod { 9 | String name() default ""; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/TargetClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop; 2 | 3 | public class TargetClass { 4 | public String doSomething(String param) { 5 | System.out.println("===================targetClass doSomething================="); 6 | return "===================targetClass doSomething================="; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/advisorAdvice.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop; 2 | 3 | import org.springframework.aop.AfterReturningAdvice; 4 | import org.springframework.aop.MethodBeforeAdvice; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | public class advisorAdvice implements MethodBeforeAdvice,AfterReturningAdvice { 9 | @Override 10 | public void before(Method method, Object[] args, Object target) throws Throwable { 11 | System.out.println("advisorAdvice ================前置通知"); 12 | } 13 | 14 | @Override 15 | public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { 16 | System.out.println("advisorAdvice ================afterReturning"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/aspect/AspectAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.aspect; 2 | 3 | import com.zhuguang.jack.annotation.TargetMethod; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.ProceedingJoinPoint; 6 | import org.aspectj.lang.annotation.*; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | //@Aspect 11 | public class AspectAnnotation { 12 | 13 | @Pointcut("execution(public * com.zhuguang.jack.service.*.*(..))") 14 | public void pc1(){} 15 | 16 | @Before("pc1()") 17 | public void before(JoinPoint joinPoint) { 18 | System.out.println("==============AspectAnnotation 前置通知========="); 19 | } 20 | 21 | @After("pc1()") 22 | public void after(JoinPoint joinPoint) { 23 | System.out.println("==============AspectAnnotation 后置通知========="); 24 | } 25 | 26 | @Around("pc1()") 27 | public void around(ProceedingJoinPoint joinPoint) throws Throwable { 28 | System.out.println("==============AspectAnnotation around前置通知========="); 29 | joinPoint.proceed(); 30 | System.out.println("==============AspectAnnotation around后置通知========="); 31 | } 32 | 33 | @Before(value = "@annotation(targetMethod)",argNames = "joinPoint,targetMethod") 34 | public void xx(JoinPoint joinPoint, TargetMethod targetMethod) { 35 | System.out.println("===============注解拦截 前置通知========="); 36 | System.out.println("==================targetMethod.name = " + targetMethod.name()); 37 | } 38 | 39 | @Before(value = "pc1()&&@annotation(targetMethod)",argNames = "joinPoint,targetMethod") 40 | public void aa(JoinPoint joinPoint,TargetMethod targetMethod) { 41 | System.out.println("===============注解拦截 前置通知========="); 42 | System.out.println("==================targetMethod.name = " + targetMethod.name()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/aspect/AspectXml1.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.aspect; 2 | 3 | import com.zhuguang.jack.annotation.TargetMethod; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.ProceedingJoinPoint; 6 | 7 | public class AspectXml1 { 8 | public void before(JoinPoint joinPoint){ 9 | System.out.println(joinPoint.getSignature().getName()); 10 | System.out.println(joinPoint.getSignature().toString()); 11 | System.out.println(joinPoint.getSignature().getDeclaringType()); 12 | System.out.println(joinPoint.getSignature().getDeclaringTypeName()); 13 | System.out.println(joinPoint.getSignature().toLongString()); 14 | System.out.println(joinPoint.getSignature().toShortString()); 15 | System.out.println("AspectXml1====前置通知"); 16 | } 17 | 18 | public void afterReturning(JoinPoint joinPoint, Object returnVal){ 19 | System.out.println("AspectXml1=====后置通知-->返回值:"+returnVal); 20 | } 21 | 22 | //ProceedingJoinPoint is only supported for around advice 23 | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { 24 | System.out.println("AspectXml1=====环绕通知前"); 25 | Object object= joinPoint.proceed(); 26 | System.out.println("AspectXml1=====环绕通知后"); 27 | return object; 28 | } 29 | 30 | public void afterThrowing(Exception e){ 31 | System.out.println("AspectXml1======异常通知:"+ e.getMessage()); 32 | } 33 | 34 | public void after(JoinPoint joinPoint){ 35 | System.out.println("AspectXml1=====最终通知"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/aspect/AspectXml2.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.aspect; 2 | 3 | import org.aspectj.lang.ProceedingJoinPoint; 4 | 5 | public class AspectXml2 { 6 | public void before(){ 7 | System.out.println("AspectXml2====前置通知"); 8 | } 9 | 10 | public void afterReturning(Object returnVal){ 11 | System.out.println("AspectXml2=====后置通知-->返回值:"+returnVal); 12 | } 13 | 14 | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { 15 | System.out.println("AspectXml2=====环绕通知前"); 16 | Object object= joinPoint.proceed(); 17 | System.out.println("AspectXml2=====环绕通知后"); 18 | return object; 19 | } 20 | 21 | public void afterThrowing(Exception e){ 22 | System.out.println("AspectXml2======异常通知:"+ e.getMessage()); 23 | } 24 | 25 | public void after(){ 26 | System.out.println("AspectXml2=====最终通知"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/aspect/AspectXml3.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.aspect; 2 | 3 | import org.aspectj.lang.ProceedingJoinPoint; 4 | 5 | public class AspectXml3 { 6 | public void before(){ 7 | System.out.println("AspectXml3====前置通知"); 8 | } 9 | 10 | public void afterReturning(Object returnVal){ 11 | System.out.println("AspectXml3=====后置通知-->返回值:"+returnVal); 12 | } 13 | 14 | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { 15 | System.out.println("AspectXml3=====环绕通知前"); 16 | Object object= joinPoint.proceed(); 17 | System.out.println("AspectXml3=====环绕通知后"); 18 | return object; 19 | } 20 | 21 | public void afterThrowing(Exception e){ 22 | System.out.println("AspectXml3======异常通知:"+ e.getMessage()); 23 | } 24 | 25 | public void after(){ 26 | System.out.println("AspectXml3=====最终通知"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/CglibBeanFactory.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.Callback; 4 | import org.springframework.cglib.proxy.CallbackFilter; 5 | import org.springframework.cglib.proxy.Enhancer; 6 | import org.springframework.cglib.proxy.NoOp; 7 | 8 | public class CglibBeanFactory { 9 | 10 | public static Object getInstance() { 11 | Enhancer enhancer = new Enhancer(); 12 | enhancer.setSuperclass(UserServiceImpl.class); 13 | CallbackFilter callbackFilter = new CglibCallbackFilter(); 14 | enhancer.setCallbackFilter(callbackFilter); 15 | 16 | Callback callback1 = new DosomethingIntercepter1(); 17 | Callback callback2 = new DosomethingIntercepter2(); 18 | Callback callback3 = new DosomethingIntercepter3(); 19 | //这个NoOp表示no operator,即什么操作也不做,代理类直接调用被代理的方法不进行拦截。 20 | Callback noop = NoOp.INSTANCE; 21 | Callback fixdValueCallback = new FixedValueIntercepter(); 22 | enhancer.setCallbacks(new Callback[]{callback1,callback2,callback3,noop,fixdValueCallback}); 23 | return enhancer.create(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/CglibCallbackFilter.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.CallbackFilter; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | public class CglibCallbackFilter implements CallbackFilter { 8 | @Override 9 | public int accept(Method method) { 10 | if ("doSomething0".equalsIgnoreCase(method.getName())) { 11 | return 3; 12 | } else if ("doSomething1".equalsIgnoreCase(method.getName())) { 13 | return 1; 14 | } else if ("doSomething2".equalsIgnoreCase(method.getName())) { 15 | return 2; 16 | } else if ("xx".equalsIgnoreCase(method.getName())){ 17 | return 3; 18 | } else { 19 | return 4; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/DosomethingIntercepter1.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.MethodInterceptor; 4 | import org.springframework.cglib.proxy.MethodProxy; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | public class DosomethingIntercepter1 implements MethodInterceptor { 9 | @Override 10 | public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { 11 | System.out.println(method.getName() + "执行前..."); 12 | Object object = methodProxy.invokeSuper(o, objects); 13 | System.out.println(method.getName() + "执行后..."); 14 | return object; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/DosomethingIntercepter2.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.MethodInterceptor; 4 | import org.springframework.cglib.proxy.MethodProxy; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | public class DosomethingIntercepter2 implements MethodInterceptor { 9 | @Override 10 | public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { 11 | System.out.println(method.getName() + "执行前..."); 12 | Object object = methodProxy.invokeSuper(o, objects); 13 | System.out.println(method.getName() + "执行后..."); 14 | return object; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/DosomethingIntercepter3.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.MethodInterceptor; 4 | import org.springframework.cglib.proxy.MethodProxy; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | public class DosomethingIntercepter3 implements MethodInterceptor { 9 | @Override 10 | public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { 11 | System.out.println(method.getName() + "执行前..."); 12 | Object object = methodProxy.invokeSuper(o, objects); 13 | System.out.println(method.getName() + "执行后..."); 14 | return object; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/FixedValueIntercepter.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | import org.springframework.cglib.proxy.FixedValue; 4 | 5 | public class FixedValueIntercepter implements FixedValue { 6 | @Override 7 | public Object loadObject() throws Exception { 8 | System.out.println("==================loadObject value"); 9 | return "my value 111"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/Test.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | public class Test { 4 | public static void main(String[] args) { 5 | UserService userService = (UserService)CglibBeanFactory.getInstance(); 6 | System.out.println(userService.myMethod("Jack")); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/UserService.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | public interface UserService { 4 | public String doSomething0(String param); 5 | 6 | public String doSomething1(String param); 7 | 8 | public String doSomething2(String param); 9 | 10 | public String myMethod(String param); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/cglib/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.cglib; 2 | 3 | public class UserServiceImpl implements UserService { 4 | @Override 5 | public String doSomething0(String param) { 6 | System.out.println("==============doSomething0"); 7 | return "doSomething0"; 8 | } 9 | 10 | @Override 11 | public String doSomething1(String param) { 12 | System.out.println("==============doSomething1"); 13 | return "doSomething1"; 14 | } 15 | 16 | @Override 17 | public String doSomething2(String param) { 18 | System.out.println("==============doSomething2"); 19 | return "doSomething2"; 20 | } 21 | 22 | @Override 23 | public String myMethod(String param) { 24 | System.out.println("==============myMethod"); 25 | return "myMethod"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/jdkProxy/Advice.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.jdkProxy; 2 | 3 | import java.lang.reflect.InvocationHandler; 4 | import java.lang.reflect.Method; 5 | 6 | public class Advice implements InvocationHandler { 7 | 8 | People people; 9 | 10 | public Advice(People people) { 11 | this.people = people; 12 | } 13 | 14 | @Override 15 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { 16 | 17 | //前置增强 18 | before(); 19 | 20 | //被代理方法 21 | Object value = method.invoke(people,args); 22 | 23 | //后置增强 24 | after(); 25 | 26 | return value; 27 | } 28 | 29 | private void before() { 30 | System.out.println("===========jack吃饭之前需要洗手=========="); 31 | } 32 | 33 | private void after() { 34 | System.out.println("===========jack吃完饭要洗碗============="); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/jdkProxy/Jack.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.jdkProxy; 2 | 3 | public class Jack implements People { 4 | @Override 5 | public String eat(String param) { 6 | System.out.println("=========Jack老师喜欢吃东西======="); 7 | return "=========Jack老师喜欢吃东西======="; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/jdkProxy/MyTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.jdkProxy; 2 | 3 | import java.lang.reflect.Proxy; 4 | 5 | public class MyTest { 6 | public static void main(String[] args) { 7 | People proxyObject = (People)Proxy.newProxyInstance(MyTest.class.getClassLoader(), new Class[]{People.class}, 8 | new Advice(new Jack())); 9 | 10 | proxyObject.eat("chi"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aop/jdkProxy/People.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aop.jdkProxy; 2 | 3 | public interface People { 4 | public String eat(String param); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.applicationContextInitializer; 2 | 3 | import org.springframework.context.ApplicationContextInitializer; 4 | import org.springframework.context.ConfigurableApplicationContext; 5 | import org.springframework.core.PriorityOrdered; 6 | 7 | public class MyApplicationContextInitializer implements ApplicationContextInitializer,PriorityOrdered { 8 | @Override 9 | public void initialize(ConfigurableApplicationContext applicationContext) { 10 | System.out.println("===========MyApplicationContextInitializer"); 11 | } 12 | 13 | @Override 14 | public int getOrder() { 15 | return 0; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer1.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.applicationContextInitializer; 2 | 3 | import org.springframework.context.ApplicationContextInitializer; 4 | import org.springframework.context.ConfigurableApplicationContext; 5 | import org.springframework.core.PriorityOrdered; 6 | 7 | public class MyApplicationContextInitializer1 implements ApplicationContextInitializer,PriorityOrdered { 8 | //在spring容器初始化之前对spring的上下文做一些修改 9 | @Override 10 | public void initialize(ConfigurableApplicationContext applicationContext) { 11 | System.out.println("===========MyApplicationContextInitializer"); 12 | } 13 | 14 | @Override 15 | public int getOrder() { 16 | return 1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aware/LoadTimeTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aware; 2 | 3 | import org.springframework.context.weaving.LoadTimeWeaverAware; 4 | import org.springframework.instrument.classloading.LoadTimeWeaver; 5 | 6 | public class LoadTimeTest implements LoadTimeWeaverAware { 7 | @Override 8 | public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver) { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aware/ProfilingAspect.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aware; 2 | 3 | import org.aspectj.lang.ProceedingJoinPoint; 4 | import org.aspectj.lang.annotation.Around; 5 | import org.aspectj.lang.annotation.Aspect; 6 | import org.aspectj.lang.annotation.Pointcut; 7 | import org.springframework.util.StopWatch; 8 | 9 | @Aspect 10 | public class ProfilingAspect { 11 | 12 | @Around("profileMethod()") 13 | public Object profile(ProceedingJoinPoint pjp) throws Throwable { 14 | StopWatch sw = new StopWatch(getClass().getSimpleName()); 15 | try { 16 | sw.start(pjp.getSignature().getName()); 17 | return pjp.proceed(); 18 | } finally { 19 | sw.stop(); 20 | System.out.println(sw.prettyPrint()); 21 | } 22 | } 23 | 24 | @Pointcut("execution(public * com.zhuguang..*(..))") 25 | public void profileMethod() { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aware/TargetClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aware; 2 | 3 | public class TargetClass { 4 | public void doSomething() { 5 | System.out.println("========================> I am targetClass!!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/aware/Test.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.aware; 2 | 3 | import org.springframework.context.support.ClassPathXmlApplicationContext; 4 | 5 | import java.io.IOException; 6 | 7 | public class Test { 8 | public static void main(String[] args) throws IOException { 9 | ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext 10 | ("classpath*:config/spring/applicationContext-core.xml"); 11 | TargetClass bean = (TargetClass) ctx.getBean("targetClass"); 12 | // TargetClass tc = new TargetClass(); 13 | bean.doSomething(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultConfigArea.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | public class ConsultConfigArea { 4 | 5 | public String areaCode; 6 | 7 | public String areaName; 8 | 9 | public String state; 10 | 11 | public String getAreaCode() { 12 | return areaCode; 13 | } 14 | 15 | public void setAreaCode(String areaCode) { 16 | this.areaCode = areaCode; 17 | } 18 | 19 | public String getAreaName() { 20 | return areaName; 21 | } 22 | 23 | public void setAreaName(String areaName) { 24 | this.areaName = areaName; 25 | } 26 | 27 | public String getState() { 28 | return state; 29 | } 30 | 31 | public void setState(String state) { 32 | this.state = state; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultContent.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | public class ConsultContent { 4 | 5 | public Integer id; 6 | 7 | public Integer itemIndex; 8 | 9 | public String content; 10 | 11 | public String type; 12 | 13 | public Integer state; 14 | 15 | public Integer getItemIndex() { 16 | return itemIndex; 17 | } 18 | 19 | public void setItemIndex(Integer itemIndex) { 20 | this.itemIndex = itemIndex; 21 | } 22 | 23 | public String getContent() { 24 | return content; 25 | } 26 | 27 | public void setContent(String content) { 28 | this.content = content; 29 | } 30 | 31 | public String getType() { 32 | return type; 33 | } 34 | 35 | public void setType(String type) { 36 | this.type = type; 37 | } 38 | 39 | public Integer getState() { 40 | return state; 41 | } 42 | 43 | public void setState(Integer state) { 44 | this.state = state; 45 | } 46 | 47 | public Integer getId() { 48 | return id; 49 | } 50 | 51 | public void setId(Integer id) { 52 | this.id = id; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultContract.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | public class ConsultContract implements Serializable { 6 | 7 | private static final long serialVersionUID = 8127035730921338189L; 8 | 9 | private Integer contractId; 10 | 11 | private String psptId; 12 | 13 | private String contractCode; 14 | 15 | private String activeTime; 16 | 17 | private Integer state; 18 | 19 | public Integer getContractId() { 20 | return contractId; 21 | } 22 | 23 | public void setContractId(Integer contractId) { 24 | this.contractId = contractId; 25 | } 26 | 27 | public String getPsptId() { 28 | return psptId; 29 | } 30 | 31 | public void setPsptId(String psptId) { 32 | this.psptId = psptId; 33 | } 34 | 35 | public String getContractCode() { 36 | return contractCode; 37 | } 38 | 39 | public void setContractCode(String contractCode) { 40 | this.contractCode = contractCode; 41 | } 42 | 43 | public String getActiveTime() { 44 | return activeTime; 45 | } 46 | 47 | public void setActiveTime(String activeTime) { 48 | this.activeTime = activeTime; 49 | } 50 | 51 | public Integer getState() { 52 | return state; 53 | } 54 | 55 | public void setState(Integer state) { 56 | this.state = state; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultIdCardInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | public class ConsultIdCardInfo { 4 | public Integer innerId; 5 | 6 | public String psptId; 7 | 8 | public String name; 9 | 10 | public String sex; 11 | 12 | public String birthday; 13 | 14 | public String address; 15 | 16 | public String picture; 17 | 18 | public String activeTime; 19 | 20 | public String nation; 21 | 22 | public Integer getInnerId() { 23 | return innerId; 24 | } 25 | 26 | public void setInnerId(Integer innerId) { 27 | this.innerId = innerId; 28 | } 29 | 30 | public String getPsptId() { 31 | return psptId; 32 | } 33 | 34 | public void setPsptId(String psptId) { 35 | this.psptId = psptId; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | public String getSex() { 47 | return sex; 48 | } 49 | 50 | public void setSex(String sex) { 51 | this.sex = sex; 52 | } 53 | 54 | public String getBirthday() { 55 | return birthday; 56 | } 57 | 58 | public void setBirthday(String birthday) { 59 | this.birthday = birthday; 60 | } 61 | 62 | public String getAddress() { 63 | return address; 64 | } 65 | 66 | public void setAddress(String address) { 67 | this.address = address; 68 | } 69 | 70 | public String getPicture() { 71 | return picture; 72 | } 73 | 74 | public void setPicture(String picture) { 75 | this.picture = picture; 76 | } 77 | 78 | public String getActiveTime() { 79 | return activeTime; 80 | } 81 | 82 | public void setActiveTime(String activeTime) { 83 | this.activeTime = activeTime; 84 | } 85 | 86 | public String getNation() { 87 | return nation; 88 | } 89 | 90 | public void setNation(String nation) { 91 | this.nation = nation; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultRecord.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | public class ConsultRecord { 4 | 5 | public Integer id; 6 | 7 | public String psptId; 8 | 9 | public String name; 10 | 11 | public String activeTime; 12 | 13 | public String autograph; 14 | 15 | public String ispass; 16 | 17 | public String docautograph; 18 | 19 | public String fingerprint; 20 | 21 | public String printFlag; 22 | 23 | public String remark; 24 | 25 | public String getPsptId() { 26 | return psptId; 27 | } 28 | 29 | public void setPsptId(String psptId) { 30 | this.psptId = psptId; 31 | } 32 | 33 | public String getActiveTime() { 34 | return activeTime; 35 | } 36 | 37 | public void setActiveTime(String activeTime) { 38 | this.activeTime = activeTime; 39 | } 40 | 41 | public String getAutograph() { 42 | return autograph; 43 | } 44 | 45 | public void setAutograph(String autograph) { 46 | this.autograph = autograph; 47 | } 48 | 49 | public String getIspass() { 50 | return ispass; 51 | } 52 | 53 | public void setIspass(String ispass) { 54 | this.ispass = ispass; 55 | } 56 | 57 | public String getDocautograph() { 58 | return docautograph; 59 | } 60 | 61 | public void setDocautograph(String docautograph) { 62 | this.docautograph = docautograph; 63 | } 64 | 65 | public String getFingerprint() { 66 | return fingerprint; 67 | } 68 | 69 | public void setFingerprint(String fingerprint) { 70 | this.fingerprint = fingerprint; 71 | } 72 | 73 | public String getPrintFlag() { 74 | return printFlag; 75 | } 76 | 77 | public void setPrintFlag(String printFlag) { 78 | this.printFlag = printFlag; 79 | } 80 | 81 | public String getRemark() { 82 | return remark; 83 | } 84 | 85 | public void setRemark(String remark) { 86 | this.remark = remark; 87 | } 88 | 89 | public Integer getId() { 90 | return id; 91 | } 92 | 93 | public void setId(Integer id) { 94 | this.id = id; 95 | } 96 | 97 | public String getName() { 98 | return name; 99 | } 100 | 101 | public void setName(String name) { 102 | this.name = name; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/ConsultRecordCount.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | public class ConsultRecordCount { 4 | 5 | public String psptId; 6 | 7 | public Integer isproduce; 8 | 9 | public Integer unproduce; 10 | 11 | public String getPsptId() { 12 | return psptId; 13 | } 14 | 15 | public void setPsptId(String psptId) { 16 | this.psptId = psptId; 17 | } 18 | 19 | public Integer getIsproduce() { 20 | return isproduce; 21 | } 22 | 23 | public void setIsproduce(Integer isproduce) { 24 | this.isproduce = isproduce; 25 | } 26 | 27 | public Integer getUnproduce() { 28 | return unproduce; 29 | } 30 | 31 | public void setUnproduce(Integer unproduce) { 32 | this.unproduce = unproduce; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/Module.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | public class Module implements Serializable { 8 | private Integer mid; 9 | 10 | private String mname; 11 | 12 | private Set roles = new HashSet(); 13 | 14 | public Integer getMid() { 15 | return mid; 16 | } 17 | 18 | public void setMid(Integer mid) { 19 | this.mid = mid; 20 | } 21 | 22 | public String getMname() { 23 | return mname; 24 | } 25 | 26 | public void setMname(String mname) { 27 | this.mname = mname; 28 | } 29 | 30 | public Set getRoles() { 31 | return roles; 32 | } 33 | 34 | public void setRoles(Set roles) { 35 | this.roles = roles; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/MyBeanUtils.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.beans.PropertyDescriptor; 4 | import java.lang.reflect.Method; 5 | import java.util.Map; 6 | 7 | public class MyBeanUtils { 8 | public static Object getPropertyValue(String propertyName, Object bean) { 9 | Object propertyValue = null; 10 | try { 11 | PropertyDescriptor pd = new PropertyDescriptor(propertyName, bean.getClass()); 12 | //getUsername method 13 | Method method = pd.getReadMethod(); 14 | propertyValue = method.invoke(bean); 15 | } catch (Exception e) { 16 | e.printStackTrace(); 17 | } 18 | 19 | return propertyValue; 20 | } 21 | 22 | public static void setProperty(Object bean, String name, Object value) { 23 | try { 24 | //內省 25 | PropertyDescriptor pd = new PropertyDescriptor(name, bean.getClass()); 26 | Method method = pd.getWriteMethod(); 27 | method.invoke(bean, value); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | } 32 | 33 | public static Object populate(Object bean, Map map) { 34 | if (map != null && map.size() > 0) { 35 | for (Map.Entry entry : map.entrySet()) { 36 | String propertyName = entry.getKey(); 37 | Object propertyValue = entry.getValue(); 38 | try { 39 | PropertyDescriptor pd = new PropertyDescriptor(propertyName, bean.getClass()); 40 | Method method = pd.getWriteMethod(); 41 | method.invoke(bean, propertyValue); 42 | } catch (Exception e) { 43 | throw new RuntimeException(e); 44 | } 45 | } 46 | } 47 | return bean; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/PropertyDescriptorTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.beans.*; 4 | import java.lang.reflect.Method; 5 | import java.lang.reflect.TypeVariable; 6 | 7 | public class PropertyDescriptorTest { 8 | public static void main(String[] args) { 9 | try { 10 | BeanInfo beanInfo = Introspector.getBeanInfo(ConsultContent.class); 11 | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); 12 | BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); 13 | Class beanClass = beanDescriptor.getBeanClass(); 14 | Object obj = beanClass.newInstance(); 15 | 16 | for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { 17 | Method writeMethod = propertyDescriptor.getWriteMethod(); 18 | System.out.println("writerMethod : " + writeMethod.getName()); 19 | TypeVariable[] typeParameters = writeMethod.getTypeParameters(); 20 | for (TypeVariable genericParameterType : typeParameters) { 21 | System.out.println(genericParameterType.getName()); 22 | } 23 | 24 | Method readMethod = propertyDescriptor.getReadMethod(); 25 | String readmethodName = readMethod.getName(); 26 | System.out.println("readMethod : " + readmethodName); 27 | 28 | } 29 | } catch (IntrospectionException e) { 30 | e.printStackTrace(); 31 | } catch (IllegalAccessException e) { 32 | e.printStackTrace(); 33 | } catch (InstantiationException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/Role.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | public class Role implements Serializable { 8 | private Integer rid; 9 | 10 | private String rname; 11 | 12 | private Set users = new HashSet(); 13 | 14 | private Set modules = new HashSet(); 15 | 16 | public Integer getRid() { 17 | return rid; 18 | } 19 | 20 | public void setRid(Integer rid) { 21 | this.rid = rid; 22 | } 23 | 24 | public String getRname() { 25 | return rname; 26 | } 27 | 28 | public void setRname(String rname) { 29 | this.rname = rname; 30 | } 31 | 32 | public Set getUsers() { 33 | return users; 34 | } 35 | 36 | public void setUsers(Set users) { 37 | this.users = users; 38 | } 39 | 40 | public Set getModules() { 41 | return modules; 42 | } 43 | 44 | public void setModules(Set modules) { 45 | this.modules = modules; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/bean/User.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.bean; 2 | 3 | import java.io.Serializable; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | public class User implements Serializable { 8 | private Integer uid; 9 | 10 | private String username; 11 | 12 | private String password; 13 | 14 | private Set roles = new HashSet(); 15 | 16 | public Integer getUid() { 17 | return uid; 18 | } 19 | 20 | public void setUid(Integer uid) { 21 | this.uid = uid; 22 | } 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | 40 | public Set getRoles() { 41 | return roles; 42 | } 43 | 44 | public void setRoles(Set roles) { 45 | this.roles = roles; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/beanDefinitionRegistryPostProcessor/MyBeanDefinitionRegistryPostProcessor.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.beanDefinitionRegistryPostProcessor; 2 | 3 | import com.zhuguang.jack.annotation.MyService; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.beans.factory.config.BeanDefinition; 6 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 7 | import org.springframework.beans.factory.support.BeanDefinitionRegistry; 8 | import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; 9 | import org.springframework.context.annotation.ClassPathBeanDefinitionScanner; 10 | import org.springframework.core.Ordered; 11 | import org.springframework.core.PriorityOrdered; 12 | import org.springframework.core.type.filter.AnnotationTypeFilter; 13 | 14 | public class MyBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor, PriorityOrdered{ 15 | @Override 16 | public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { 17 | String[] beanDefinitionNames = registry.getBeanDefinitionNames(); 18 | for (String beanDefinitionName : beanDefinitionNames) { 19 | System.out.println("beanDefinitionName : " + beanDefinitionName); 20 | BeanDefinition beanDefinition = registry.getBeanDefinition(beanDefinitionName); 21 | System.out.println(beanDefinition.getAttribute("key")); 22 | } 23 | 24 | ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(registry); 25 | scanner.addIncludeFilter(new AnnotationTypeFilter(MyService.class)); 26 | scanner.scan("com.zhuguang.jack.annotation"); 27 | 28 | } 29 | 30 | @Override 31 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { 32 | 33 | } 34 | 35 | @Override 36 | public int getOrder() { 37 | return 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/beanDefinitionRegistryPostProcessor/MyBeanFactoryPostProcessor.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.beanDefinitionRegistryPostProcessor; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor; 5 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 6 | 7 | public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor { 8 | @Override 9 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/cache/MongodbCache.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.cache; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.zhuguang.jack.mongodb.MongoDBUser; 5 | import org.apache.commons.lang3.SerializationUtils; 6 | import org.springframework.cache.Cache; 7 | import org.springframework.cache.support.SimpleValueWrapper; 8 | import org.springframework.data.mongodb.core.MongoTemplate; 9 | import org.springframework.data.mongodb.core.query.Criteria; 10 | import org.springframework.data.mongodb.core.query.Query; 11 | 12 | import java.io.Serializable; 13 | import java.sql.Connection; 14 | import java.util.concurrent.Callable; 15 | 16 | public class MongodbCache implements Cache { 17 | 18 | private String name; 19 | 20 | private MongoTemplate mongoTemplate; 21 | 22 | private String collection; 23 | 24 | public void setCollection(String collection) { 25 | this.collection = collection; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public void setMongoTemplate(MongoTemplate mongoTemplate) { 33 | this.mongoTemplate = mongoTemplate; 34 | } 35 | 36 | @Override 37 | public String getName() { 38 | return this.name; 39 | } 40 | 41 | @Override 42 | public Object getNativeCache() { 43 | return this.mongoTemplate; 44 | } 45 | 46 | @Override 47 | public ValueWrapper get(Object key) { 48 | System.out.println("------缓存获取mongodb-------"+key.toString()); 49 | Object value = null; 50 | String keyf = key.toString(); 51 | byte[] keyb = keyf.getBytes(); 52 | MongodbCacheBean bean = mongoTemplate.findOne(new Query(Criteria.where("id").is(keyb)), 53 | MongodbCacheBean.class, 54 | collection); 55 | if(bean != null) { 56 | System.out.println("------获取到数据为:" + bean.getId() + ":" + bean.getValue() + "---------"); 57 | value = SerializationUtils.deserialize(bean.getValue()); 58 | } 59 | return value != null ? new SimpleValueWrapper(value) : null; 60 | } 61 | 62 | @Override 63 | public T get(Object key, Class type) { 64 | return null; 65 | } 66 | 67 | @Override 68 | public T get(Object key, Callable valueLoader) { 69 | return null; 70 | } 71 | 72 | @Override 73 | public void put(Object key, Object value) { 74 | System.out.println("-------加入缓存mongodb------"); 75 | System.out.println("--------key----:"+key); 76 | System.out.println("--------value----:"+value); 77 | String keyString = key.toString(); 78 | byte[] keyb = keyString.getBytes(); 79 | byte[] valueb = SerializationUtils.serialize((Serializable) value); 80 | MongodbCacheBean bean = new MongodbCacheBean(); 81 | bean.setId(keyb); 82 | bean.setValue(valueb); 83 | mongoTemplate.insert(bean,collection); 84 | } 85 | 86 | @Override 87 | public ValueWrapper putIfAbsent(Object key, Object value) { 88 | return null; 89 | } 90 | 91 | @Override 92 | public void evict(Object key) { 93 | mongoTemplate.remove(new Query(Criteria.where("id").is(key)),collection); 94 | } 95 | 96 | @Override 97 | public void clear() { 98 | mongoTemplate.remove(new Query(),collection); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/cache/MongodbCacheBean.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.cache; 2 | 3 | public class MongodbCacheBean { 4 | private byte[] id; 5 | 6 | private byte[] value; 7 | 8 | public byte[] getId() { 9 | return this.id; 10 | } 11 | 12 | public void setId(byte[] id) { 13 | this.id = id; 14 | } 15 | 16 | public byte[] getValue() { 17 | return this.value; 18 | } 19 | 20 | public void setValue(byte[] value) { 21 | this.value = value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/cache/RedisCache.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.cache; 2 | 3 | import org.apache.commons.lang3.SerializationUtils; 4 | import org.springframework.cache.Cache; 5 | import org.springframework.cache.support.SimpleValueWrapper; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.data.redis.connection.RedisConnection; 8 | import org.springframework.data.redis.core.RedisCallback; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | 11 | import java.io.Serializable; 12 | import java.util.concurrent.Callable; 13 | 14 | public class RedisCache implements Cache { 15 | 16 | private RedisTemplate redisTemplate; 17 | 18 | private String name; 19 | 20 | public void setRedisTemplate(RedisTemplate redisTemplate) { 21 | this.redisTemplate = redisTemplate; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | 28 | @Override 29 | public void clear() { 30 | System.out.println("-------緩存清理------"); 31 | redisTemplate.execute(new RedisCallback() { 32 | @Override 33 | public String doInRedis(RedisConnection connection) throws DataAccessException { 34 | connection.flushDb(); 35 | return "ok"; 36 | } 37 | }); 38 | } 39 | 40 | @Override 41 | public void evict(Object key) { 42 | System.out.println("-------緩存刪除------"); 43 | final String keyf=key.toString(); 44 | redisTemplate.execute(new RedisCallback() { 45 | @Override 46 | public Long doInRedis(RedisConnection connection) throws DataAccessException { 47 | return connection.del(keyf.getBytes()); 48 | } 49 | 50 | }); 51 | 52 | } 53 | 54 | @Override 55 | public ValueWrapper get(Object key) { 56 | System.out.println("------缓存获取-------"+key.toString()); 57 | final String keyf = key.toString(); 58 | Object object = null; 59 | object = redisTemplate.execute(new RedisCallback() { 60 | @Override 61 | public Object doInRedis(RedisConnection connection) throws DataAccessException { 62 | byte[] key = keyf.getBytes(); 63 | byte[] value = connection.get(key); 64 | if (value == null) { 65 | System.out.println("------缓存不存在-------"); 66 | return null; 67 | } 68 | return SerializationUtils.deserialize(value); 69 | } 70 | }); 71 | ValueWrapper obj=(object != null ? new SimpleValueWrapper(object) : null); 72 | System.out.println("------获取到内容-------"+obj); 73 | return obj; 74 | } 75 | 76 | @Override 77 | public T get(Object key, Class type) { 78 | return null; 79 | } 80 | 81 | @Override 82 | public void put(Object key, Object value) { 83 | System.out.println("-------加入缓存------"); 84 | System.out.println("key----:"+key); 85 | System.out.println("value----:"+value); 86 | final String keyString = key.toString(); 87 | final Object valuef = value; 88 | final long liveTime = 86400; 89 | redisTemplate.execute(new RedisCallback() { 90 | @Override 91 | public Long doInRedis(RedisConnection connection) throws DataAccessException { 92 | byte[] keyb = keyString.getBytes(); 93 | byte[] valueb = SerializationUtils.serialize((Serializable) valuef); 94 | connection.set(keyb, valueb); 95 | if (liveTime > 0) { 96 | connection.expire(keyb, liveTime); 97 | } 98 | return 1L; 99 | } 100 | }); 101 | 102 | } 103 | 104 | @Override 105 | public T get(Object key, Callable valueLoader) { 106 | return null; 107 | } 108 | 109 | @Override 110 | public String getName() { 111 | return this.name; 112 | } 113 | 114 | @Override 115 | public Object getNativeCache() { 116 | return this.redisTemplate; 117 | } 118 | 119 | @Override 120 | public ValueWrapper putIfAbsent(Object arg0, Object arg1) { 121 | // TODO Auto-generated method stub 122 | return null; 123 | } 124 | 125 | public RedisTemplate getRedisTemplate() { 126 | return redisTemplate; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/BeanNameUrlController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import org.springframework.web.servlet.ModelAndView; 4 | import org.springframework.web.servlet.mvc.AbstractController; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | public class BeanNameUrlController extends AbstractController { 10 | @Override 11 | protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 12 | System.out.println("===========BeanNameUrlController=========="); 13 | ModelAndView modelAndView = new ModelAndView(); 14 | modelAndView.setViewName("ok"); 15 | return modelAndView; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/CommonController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import com.zhuguang.jack.bean.ConsultContent; 4 | import com.zhuguang.jack.bean.User; 5 | import com.zhuguang.jack.exception.PasswordCheckException; 6 | import com.zhuguang.jack.scope.ScopeTest; 7 | import com.zhuguang.jack.service.CacheServiceImpl; 8 | import com.zhuguang.jack.service.MyService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Qualifier; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.*; 13 | import org.springframework.web.servlet.view.RedirectView; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpSession; 17 | import java.io.IOException; 18 | import java.io.PrintWriter; 19 | import java.io.Writer; 20 | import java.util.Enumeration; 21 | import java.util.HashMap; 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | @Controller 26 | @RequestMapping("/common") 27 | @SessionAttributes(value={ "intValue" , "hello" }, types={User. class }) 28 | public class CommonController { 29 | 30 | @Autowired 31 | ScopeTest scopeTest; 32 | 33 | @Autowired 34 | @Qualifier("annotationServiceImpl") 35 | MyService myService; 36 | 37 | /* 38 | content-type 39 | * username=jack&password=123&name=roy 40 | * json 41 | * {} 42 | * 43 | * /common/index 44 | * /common/index* 45 | * /commom/queryContent 46 | * /commom/queryContent* 47 | * /common/sayHello 48 | * /common/responseStatus 49 | * 50 | * */ 51 | @RequestMapping("/index") 52 | public @ResponseBody 53 | String index() { 54 | System.out.println(scopeTest.getUsername()); 55 | if(true) throw new RuntimeException("=======xxx"); 56 | return "ok"; 57 | } 58 | 59 | @RequestMapping("/queryContent") 60 | public @ResponseBody 61 | List queryContent() { 62 | return myService.queryContent(new HashMap()); 63 | } 64 | 65 | @ModelAttribute("hello") 66 | public String getModel() { 67 | System.out.println("-------------Hello---------"); 68 | return "world"; 69 | } 70 | 71 | @ModelAttribute("intValue") 72 | public int getInteger() { 73 | System.out.println("-------------intValue---------------"); 74 | return 10; 75 | } 76 | 77 | @RequestMapping("sayHello") 78 | public void sayHello(Map map, @ModelAttribute("hello") String hello, 79 | @ModelAttribute("intValue") int num, @ModelAttribute("user2") User user, 80 | PrintWriter writer, HttpServletRequest request) throws IOException { 81 | map.put("stringValue", "String"); 82 | writer.write("Hello " + hello + " , Hello " + user.getUsername() + num); 83 | writer.println("\r\n"); 84 | HttpSession session = request.getSession(); 85 | Enumeration enume = session.getAttributeNames(); 86 | while (enume.hasMoreElements()) { 87 | Object key = enume.nextElement(); 88 | writer.write(key + ":" + session.getAttribute((String) key)); 89 | } 90 | System.out.println(session); 91 | } 92 | 93 | @ModelAttribute("user2") 94 | public User getUser() { 95 | System.out.println("---------getUser-------------"); 96 | User user = new User(); 97 | user.setPassword("123"); 98 | user.setUsername("Jack"); 99 | user.setUid(2233); 100 | return user; 101 | } 102 | 103 | @RequestMapping("/responseStatus") 104 | public String responseStatus(@RequestParam("i") int i) { 105 | if(i == 1) { 106 | throw new PasswordCheckException(); 107 | } 108 | System.out.println("============密码校验正确"); 109 | return "ok"; 110 | } 111 | 112 | @Autowired 113 | @Qualifier("cacheServiceImpl") 114 | MyService cacheService; 115 | 116 | @RequestMapping("/cache") 117 | public @ResponseBody String cacheTest(@RequestParam String param) { 118 | String result = cacheService.doSomething(param); 119 | System.out.println("=================result : " + result); 120 | return result; 121 | } 122 | 123 | @RequestMapping("/queryUser") 124 | public @ResponseBody String queryUser(@ModelAttribute("user2") User user) { 125 | User result = cacheService.queryUser(user); 126 | System.out.println("=================result : " + result); 127 | return "============ok=========="; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/FileUploadController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import java.io.File; 12 | 13 | @Controller 14 | @RequestMapping("/file") 15 | public class FileUploadController { 16 | 17 | @RequestMapping(value = "fileUpload",method = RequestMethod.POST) 18 | public String fileUpload(@RequestParam("file") MultipartFile file, HttpServletRequest request) { 19 | // 判断文件是否为空 20 | if (!file.isEmpty()) { 21 | try { 22 | // 文件保存路径 23 | String filePath = request.getSession().getServletContext().getRealPath("/") + "fileUpload"+File.separator + "temp" 24 | + File.separator 25 | + file.getOriginalFilename(); 26 | // 转存文件 27 | file.transferTo(new File(filePath)); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | } 32 | // 重定向 33 | return "ok"; 34 | } 35 | 36 | /* 37 | * localhost:8081/showView/xxx 38 | * */ 39 | @RequestMapping("/showView/{viewName}") 40 | public String showView(@PathVariable("viewName") String viewName){ 41 | return viewName; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/FreemarkerController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import com.zhuguang.jack.bean.User; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @Controller 12 | @RequestMapping("/free") 13 | public class FreemarkerController { 14 | 15 | @RequestMapping("/home") 16 | public String home(Model model) { 17 | List list = new ArrayList<>(); 18 | User user1 = new User(); 19 | user1.setUid(1); 20 | user1.setUsername("jack"); 21 | user1.setPassword("123"); 22 | list.add(user1); 23 | User user2 = new User(); 24 | user2.setUid(2); 25 | user2.setUsername("jack2"); 26 | user2.setPassword("1232"); 27 | list.add(user2); 28 | User user3 = new User(); 29 | user3.setUid(3); 30 | user3.setUsername("jack3"); 31 | user3.setPassword("1233"); 32 | list.add(user3); 33 | model.addAttribute("users",list); 34 | return "home.ftl"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/NameController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import org.springframework.web.servlet.ModelAndView; 4 | import org.springframework.web.servlet.mvc.AbstractController; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | public class NameController extends AbstractController { 10 | @Override 11 | protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 12 | System.out.println("===============NameController.handleRequestInternal========="); 13 | ModelAndView modelAndView = new ModelAndView(); 14 | modelAndView.setViewName("ok"); 15 | return modelAndView; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.ResponseBody; 6 | 7 | @Controller 8 | @RequestMapping("/user") 9 | public class UserController { 10 | 11 | @RequestMapping("/queryUser") 12 | public @ResponseBody String queryUser(String param) { 13 | System.out.println("============" + this.getClass().getName()); 14 | return "Ok"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/controller/VelocityController.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.controller; 2 | 3 | import com.zhuguang.jack.bean.User; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.servlet.ModelAndView; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Controller 13 | @RequestMapping("/velo") 14 | public class VelocityController { 15 | 16 | @RequestMapping("/home") 17 | public ModelAndView home(Model model) { 18 | List list = new ArrayList<>(); 19 | User user1 = new User(); 20 | user1.setUid(1); 21 | user1.setUsername("jack"); 22 | user1.setPassword("123"); 23 | list.add(user1); 24 | User user2 = new User(); 25 | user2.setUid(2); 26 | user2.setUsername("jack2"); 27 | user2.setPassword("1232"); 28 | list.add(user2); 29 | User user3 = new User(); 30 | user3.setUid(3); 31 | user3.setUsername("jack3"); 32 | user3.setPassword("1233"); 33 | list.add(user3); 34 | model.addAttribute("users",list); 35 | ModelAndView modelAndView = new ModelAndView(); 36 | modelAndView.addObject("users",list); 37 | modelAndView.setViewName("home"); 38 | modelAndView.addObject("user","jack"); 39 | return modelAndView; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/dao/CommonMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.dao; 2 | 3 | import com.zhuguang.jack.bean.*; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | @Repository 10 | public interface CommonMapper { 11 | 12 | int saveArea(ConsultConfigArea area); 13 | 14 | int deleteArea(Map param); 15 | 16 | int deleteAreaAll(); 17 | 18 | int updateArea(ConsultConfigArea area); 19 | 20 | List queryAreaByAreaCode(Map param); 21 | 22 | List queryConsultRecords(Map param); 23 | 24 | List queryUserByPsptId(Map param); 25 | 26 | int saveUser(ConsultIdCardInfo record); 27 | 28 | int saveRecord(ConsultRecord record); 29 | 30 | int saveRecordCount(ConsultRecordCount recordCount); 31 | 32 | List queryRecords(Map param); 33 | 34 | List queryRecordshaveH(Map param); 35 | 36 | //@Select("select * from consult_content where type = #{type}") 37 | // @Select({""}) 41 | List queryContent(Map param); 42 | 43 | int updateRecords(Map param); 44 | 45 | int updateRecordsByPsptId(Map param); 46 | 47 | List queryRecordCount(Map param); 48 | 49 | int updateRecordCount(Map param); 50 | 51 | List qryArea(Map param); 52 | 53 | List qryContracts(Map param); 54 | 55 | int saveContracts(List contracts); 56 | 57 | int updateConsultRecord(Map param); 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/exception/PasswordCheckException.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.FORBIDDEN,reason = "密码不正确") 7 | public class PasswordCheckException extends RuntimeException { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/factoryBean/FactoryBeanTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.factoryBean; 2 | 3 | import com.zhuguang.jack.testbean.Woman; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | 6 | import java.util.Map; 7 | 8 | public class FactoryBeanTest { 9 | 10 | 11 | @Autowired(required = false) 12 | public Woman woman; 13 | 14 | @Autowired 15 | public void setWoman(Woman woman) { 16 | this.woman = woman; 17 | } 18 | 19 | public Object getObject() { 20 | System.out.println("我自己创建对象!!!"); 21 | return new Object(); 22 | } 23 | 24 | public FactoryBeanTest() { 25 | 26 | } 27 | 28 | public FactoryBeanTest(String paran,Map map) { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/handlerInterceptor/AuthInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.handlerInterceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | /* 9 | * 登录权限校验 10 | * */ 11 | public class AuthInterceptor implements HandlerInterceptor { 12 | @Override 13 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 14 | 15 | String username = request.getParameter("username"); 16 | String password = request.getParameter("password"); 17 | 18 | if(request.getRequestURI().contains(".jpg")) { 19 | return true; 20 | } 21 | 22 | if(request.getRequestURI().contains("file")) { 23 | return true; 24 | } 25 | 26 | if("jack".equals(username) && "123".equals(password)) { 27 | System.out.println("================AuthInterceptor权限校验成功================"); 28 | return true; 29 | } 30 | System.out.println("================AuthInterceptor权限校验失败================"); 31 | return false; 32 | } 33 | 34 | @Override 35 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { 36 | System.out.println("================AuthInterceptor.postHandle================"); 37 | } 38 | 39 | @Override 40 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 41 | System.out.println("================AuthInterceptor.afterCompletion================"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/handlerInterceptor/UserInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.handlerInterceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /* 10 | * 登录权限校验 11 | * */ 12 | public class UserInterceptor implements HandlerInterceptor { 13 | @Override 14 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 15 | String username = request.getParameter("username"); 16 | String password = request.getParameter("password"); 17 | if("jack".equals(username)) { 18 | System.out.println("================UserInterceptor权限校验成功================"); 19 | return true; 20 | } 21 | System.out.println("================UserInterceptor权限校验失败================"); 22 | return false; 23 | } 24 | 25 | @Override 26 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { 27 | System.out.println("================UserInterceptor.postHandle================"); 28 | } 29 | 30 | @Override 31 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 32 | System.out.println("================UserInterceptor.afterCompletion================"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/jdbc/ConnectionUtil.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.jdbc; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | 7 | public class ConnectionUtil { 8 | public final static String DB_DRIVER_CLASS = "com.mysql.jdbc.Driver"; 9 | public final static String DB_URL = "jdbc:mysql://192.168.88.139:3307/zg"; 10 | public final static String DB_USERNAME = "root"; 11 | public final static String DB_PASSWORD = "123456"; 12 | 13 | public static Connection getConnection() throws ClassNotFoundException, 14 | SQLException { 15 | Connection con = null; 16 | Class.forName(DB_DRIVER_CLASS); 17 | con = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD); 18 | System.out.println("DB Connection created successfully"); 19 | return con; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/jdbc/JDBCSavePointTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.jdbc; 2 | 3 | import java.sql.*; 4 | 5 | public class JDBCSavePointTest { 6 | public static void main(String[] args) { 7 | Connection connection = null; 8 | try { 9 | connection = ConnectionUtil.getConnection(); 10 | connection.setAutoCommit(false); 11 | insertTest(connection); 12 | insertTest1(connection); 13 | connection.commit(); 14 | } catch (ClassNotFoundException e) { 15 | e.printStackTrace(); 16 | } catch (SQLException e) { 17 | e.printStackTrace(); 18 | } finally { 19 | if (connection != null) { 20 | try { 21 | selectAll(connection); 22 | connection.close(); 23 | } catch (SQLException e) { 24 | e.printStackTrace(); 25 | } 26 | } 27 | } 28 | } 29 | public static void insertTest(Connection con){ 30 | PreparedStatement stmt = null; 31 | Savepoint a1 = null; 32 | try { 33 | stmt = con.prepareStatement("insert into test(num) values (?)"); 34 | stmt.setString(1, "q2"); 35 | stmt.executeUpdate(); 36 | System.out.println("Data inserted successfully"); 37 | stmt.close(); 38 | a1 = con.setSavepoint("a1"); 39 | } catch (SQLException e) { 40 | e.printStackTrace(); 41 | if(a1 != null) { 42 | try { 43 | con.rollback(a1); 44 | } catch (SQLException e1) { 45 | e1.printStackTrace(); 46 | } 47 | } 48 | } 49 | } 50 | 51 | public static void insertTest1(Connection con) throws SQLException { 52 | PreparedStatement stmt = null; 53 | Savepoint a2 = null; 54 | try { 55 | stmt = con.prepareStatement("insert into test1(num) values (?)"); 56 | stmt.setString(1, "q2222222222222222222"); 57 | stmt.executeUpdate(); 58 | System.out.println("Data inserted successfully"); 59 | stmt.close(); 60 | a2 = con.setSavepoint("a2"); 61 | } catch (SQLException e) { 62 | e.printStackTrace(); 63 | if(a2 != null) { 64 | try { 65 | con.rollback(a2); 66 | } catch (SQLException e1) { 67 | e1.printStackTrace(); 68 | } 69 | } 70 | } 71 | } 72 | 73 | public static void selectAll(Connection con) throws SQLException { 74 | Statement st = con.createStatement(); 75 | ResultSet rs = st.executeQuery("select * from test"); 76 | System.out.println("============test============"); 77 | while (rs.next()) { 78 | System.out.println(rs.getString("num")); 79 | } 80 | ResultSet rs1 = st.executeQuery("select * from test1"); 81 | System.out.println("============test1============"); 82 | while (rs1.next()) { 83 | System.out.println(rs1.getString("num")); 84 | } 85 | st.close(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/jdbc/JDBCTransationTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.jdbc; 2 | 3 | import java.sql.*; 4 | 5 | public class JDBCTransationTest { 6 | public static void main(String[] args) { 7 | Connection connection = null; 8 | try { 9 | connection = ConnectionUtil.getConnection(); 10 | //开启事务 11 | connection.setAutoCommit(false); 12 | insertTest(connection); 13 | insertTest1(connection); 14 | connection.commit(); 15 | } catch (ClassNotFoundException e) { 16 | e.printStackTrace(); 17 | } catch (SQLException e) { 18 | e.printStackTrace(); 19 | try { 20 | connection.rollback(); 21 | System.out.println("JDBC Transaction rolled back successfully"); 22 | } catch (SQLException e1) { 23 | System.out.println("JDBC Transaction rolled back fail" + e1.getMessage()); 24 | } 25 | } finally { 26 | if (connection != null) { 27 | try { 28 | selectAll(connection); 29 | connection.close(); 30 | } catch (SQLException e) { 31 | e.printStackTrace(); 32 | } 33 | } 34 | } 35 | } 36 | 37 | public static void insertTest(Connection con) throws SQLException { 38 | PreparedStatement stmt = con.prepareStatement("insert into test(num) values (?)"); 39 | stmt.setString(1, "JACK2"); 40 | stmt.executeUpdate(); 41 | System.out.println("Data inserted successfully"); 42 | stmt.close(); 43 | } 44 | 45 | public static void insertTest1(Connection con) throws SQLException { 46 | PreparedStatement stmt = con.prepareStatement("insert into test1(num) values (?)"); 47 | stmt.setString(1, "JACK22222222222222222222"); 48 | stmt.executeUpdate(); 49 | System.out.println("Data inserted successfully"); 50 | stmt.close(); 51 | } 52 | 53 | public static void selectAll(Connection con) throws SQLException { 54 | Statement st = con.createStatement(); 55 | ResultSet rs = st.executeQuery("select * from test"); 56 | System.out.println("============test============"); 57 | while (rs.next()) { 58 | System.out.println(rs.getString("num")); 59 | } 60 | ResultSet rs1 = st.executeQuery("select * from test1"); 61 | System.out.println("============test1============"); 62 | while (rs1.next()) { 63 | System.out.println(rs1.getString("num")); 64 | } 65 | st.close(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/jdbc/JdbcTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.jdbc; 2 | 3 | import java.sql.*; 4 | 5 | public class JdbcTest { 6 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 7 | String URL = "jdbc:mysql://192.168.88.139:3307/zg?useUnicode=true&characterEncoding=utf-8"; 8 | String USER = "root"; 9 | String PASSWORD = "123456"; 10 | Class.forName("com.mysql.jdbc.Driver"); 11 | Connection conn = DriverManager.getConnection(URL, USER, PASSWORD); 12 | Statement st = conn.createStatement(); 13 | 14 | ResultSet rs = st.executeQuery("select * from test"); 15 | while (rs.next()) { 16 | System.out.println(rs.getString("num")); 17 | } 18 | rs.close(); 19 | st.close(); 20 | conn.close(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/mm.aj: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack; 2 | 3 | public aspect mm { 4 | pointcut say(): 5 | execution(* App.say(..)); 6 | before(): say() { 7 | System.out.println("AjAspect before say"); 8 | } 9 | after(): say() { 10 | System.out.println("AjAspect after say"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/mongodb/MongoBase.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.mongodb; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public interface MongoBase { 7 | //添加 8 | void insert(T object, String collectionName); 9 | 10 | //根据条件查找单个对象 11 | T findOne(Map params, String collectionName); 12 | 13 | //查找所有 14 | List findAll(String collectionName); 15 | 16 | //修改 17 | void update(Map params, String collectionName); 18 | 19 | //创建集合 20 | void createCollection(String collectionName); 21 | 22 | //根据条件删除 23 | void remove(Map params, String collectionName); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/mongodb/MongoDBUser.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.mongodb; 2 | 3 | public class MongoDBUser { 4 | 5 | private String id; 6 | 7 | private String username; 8 | 9 | private String password; 10 | 11 | public String getId() { 12 | return id; 13 | } 14 | 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | public String getUsername() { 20 | return username; 21 | } 22 | 23 | public void setUsername(String username) { 24 | this.username = username; 25 | } 26 | 27 | public String getPassword() { 28 | return password; 29 | } 30 | 31 | public void setPassword(String password) { 32 | this.password = password; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/mongodb/MongoDBUserDao.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.mongodb; 2 | 3 | public interface MongoDBUserDao extends MongoBase { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/mongodb/MongoDBUserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.mongodb; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.data.mongodb.core.MongoTemplate; 6 | import org.springframework.data.mongodb.core.query.Criteria; 7 | import org.springframework.data.mongodb.core.query.Query; 8 | import org.springframework.data.mongodb.core.query.Update; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | @Service("mongoDBUserDao") 15 | public class MongoDBUserDaoImpl implements MongoDBUserDao { 16 | 17 | @Autowired 18 | @Qualifier("mongoTemplate") 19 | private MongoTemplate mongoTemplate; 20 | 21 | @Override 22 | public void insert(MongoDBUser object, String collectionName) { 23 | mongoTemplate.insert(object, collectionName); 24 | } 25 | 26 | @Override 27 | public MongoDBUser findOne(Map params, String collectionName) { 28 | return mongoTemplate.findOne(new Query(Criteria.where("id").is(params.get("id"))), MongoDBUser.class, 29 | collectionName); 30 | } 31 | 32 | @Override 33 | public List findAll(String collectionName) { 34 | return mongoTemplate.findAll(MongoDBUser.class, collectionName); 35 | } 36 | 37 | @Override 38 | public void update(Map params, String collectionName) { 39 | Update update = new Update(); 40 | if (null != params.get("username")) { 41 | update.set("username", params.get("username")); 42 | } 43 | if (null != params.get("password")) { 44 | update.set("password", params.get("password")); 45 | } 46 | mongoTemplate.upsert(new Query(Criteria.where("id").is(params.get("id"))), update, MongoDBUser.class, 47 | collectionName); 48 | } 49 | 50 | @Override 51 | public void createCollection(String collectionName) { 52 | mongoTemplate.createCollection(collectionName); 53 | } 54 | 55 | @Override 56 | public void remove(Map params, String collectionName) { 57 | mongoTemplate.remove(new Query(Criteria.where("id").is(params.get("id"))), MongoDBUser.class, collectionName); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/prototype/PrototypeTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.prototype; 2 | 3 | public class PrototypeTest { 4 | public String username; 5 | 6 | public String getUsername() { 7 | return this.username; 8 | } 9 | 10 | public void setUsername(String username) { 11 | this.username = username; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/prototype/PrototypeTestA.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.prototype; 2 | 3 | public class PrototypeTestA { 4 | public String username; 5 | 6 | PrototypeTestB prototypeTestB; 7 | 8 | public PrototypeTestB getPrototypeTestB() { 9 | return this.prototypeTestB; 10 | } 11 | 12 | public void setPrototypeTestB(PrototypeTestB prototypeTestB) { 13 | this.prototypeTestB = prototypeTestB; 14 | } 15 | 16 | public String getUsername() { 17 | return this.username; 18 | } 19 | 20 | public void setUsername(String username) { 21 | this.username = username; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/prototype/PrototypeTestB.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.prototype; 2 | 3 | public class PrototypeTestB { 4 | public String username; 5 | 6 | PrototypeTestA prototypeTestA; 7 | 8 | public PrototypeTestA getPrototypeTestA() { 9 | return this.prototypeTestA; 10 | } 11 | 12 | public void setPrototypeTestA(PrototypeTestA prototypeTestA) { 13 | this.prototypeTestA = prototypeTestA; 14 | } 15 | 16 | public String getUsername() { 17 | return this.username; 18 | } 19 | 20 | public void setUsername(String username) { 21 | this.username = username; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/scope/CustomBeanFactoryPostProcessor.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.scope; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor; 5 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 6 | 7 | public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { 8 | @Override 9 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { 10 | beanFactory.registerScope("jackScope",new CustomScope()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/scope/CustomScope.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.scope; 2 | 3 | import org.springframework.beans.factory.ObjectFactory; 4 | import org.springframework.beans.factory.config.Scope; 5 | 6 | public class CustomScope implements Scope { 7 | 8 | private ThreadLocal local = new ThreadLocal(); 9 | 10 | /* 11 | * 这个方法就是自己管理bean 12 | * */ 13 | @Override 14 | public Object get(String name, ObjectFactory objectFactory) { 15 | System.out.println("=============CustomScope========"); 16 | if(local.get() != null) { 17 | return local.get(); 18 | } else { 19 | //这个方法就是掉createbean方法获得一个实例 20 | Object object = objectFactory.getObject(); 21 | local.set(object); 22 | return object; 23 | } 24 | } 25 | 26 | @Override 27 | public Object remove(String name) { 28 | return null; 29 | } 30 | 31 | @Override 32 | public void registerDestructionCallback(String name, Runnable callback) { 33 | 34 | } 35 | 36 | @Override 37 | public Object resolveContextualObject(String key) { 38 | return null; 39 | } 40 | 41 | @Override 42 | public String getConversationId() { 43 | return null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/scope/CustomScopeBean.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.scope; 2 | 3 | public class CustomScopeBean { 4 | private String username; 5 | 6 | public String getUsername() { 7 | return this.username; 8 | } 9 | 10 | public void setUsername(String username) { 11 | this.username = username; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/scope/ScopeTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.scope; 2 | 3 | public class ScopeTest { 4 | public String username; 5 | 6 | public String getUsername() { 7 | return this.username; 8 | } 9 | 10 | public void setUsername(String username) { 11 | this.username = username; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/service/AbstractMyService.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.service; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.bean.ConsultContent; 5 | import com.zhuguang.jack.bean.User; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public abstract class AbstractMyService implements MyService { 11 | @Override 12 | public String doSomething(String param) { 13 | return null; 14 | } 15 | 16 | @Override 17 | public String throwTest(String param) { 18 | return null; 19 | } 20 | 21 | @Override 22 | public List queryContent(Map param) { 23 | return null; 24 | } 25 | 26 | @Override 27 | public int saveArea(ConsultConfigArea area) { 28 | return 0; 29 | } 30 | 31 | @Override 32 | public void saveTest(String param) { 33 | 34 | } 35 | 36 | @Override 37 | public void saveTest1(String param) { 38 | 39 | } 40 | 41 | @Override 42 | public void queryAllTest() { 43 | 44 | } 45 | 46 | public abstract User queryUser(User user); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/service/AnnotationServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.service; 2 | 3 | import com.zhuguang.jack.annotation.TargetMethod; 4 | import com.zhuguang.jack.bean.ConsultConfigArea; 5 | import com.zhuguang.jack.bean.ConsultContent; 6 | import com.zhuguang.jack.bean.User; 7 | import com.zhuguang.jack.dao.CommonMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 10 | import org.springframework.context.annotation.DependsOn; 11 | import org.springframework.context.annotation.Description; 12 | import org.springframework.context.annotation.Lazy; 13 | import org.springframework.context.annotation.Scope; 14 | import org.springframework.jdbc.core.JdbcTemplate; 15 | import org.springframework.stereotype.Service; 16 | import org.springframework.transaction.annotation.Isolation; 17 | import org.springframework.transaction.annotation.Propagation; 18 | import org.springframework.transaction.annotation.Transactional; 19 | 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | @Service("annotationServiceImpl") 24 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 25 | @Lazy(false) 26 | @Description("xx") 27 | public class AnnotationServiceImpl implements MyService { 28 | 29 | @Autowired 30 | CommonMapper commonMapper; 31 | 32 | @Autowired 33 | JdbcTemplate jdbcTemplate; 34 | 35 | @TargetMethod(name = "Jack") 36 | @Override 37 | public String doSomething(String param) { 38 | System.out.println("==========AnnotationServiceImpl.doSomething"); 39 | return "==========AnnotationServiceImpl.doSomething"; 40 | } 41 | 42 | @Override 43 | public String throwTest(String param) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public List queryContent(Map param) { 49 | return commonMapper.queryContent(param); 50 | } 51 | 52 | 53 | @Override 54 | public int saveArea(ConsultConfigArea area) { 55 | int count = commonMapper.saveArea(area); 56 | 57 | if(false)throw new RuntimeException("异常"); 58 | return count; 59 | } 60 | 61 | @Override 62 | public void saveTest(String param) { 63 | } 64 | 65 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 66 | @Override 67 | public void saveTest1(String param) { 68 | String sql = "insert into test1(num) values (?)"; 69 | int count = jdbcTemplate.update(sql, new Object[]{param}); 70 | // throw new RuntimeException("saveTest1 异常"); 71 | } 72 | 73 | @Override 74 | public void queryAllTest() { 75 | 76 | } 77 | 78 | @Override 79 | public User queryUser(User user) { 80 | return null; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/service/CacheServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.service; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.bean.ConsultContent; 5 | import com.zhuguang.jack.bean.User; 6 | import org.springframework.cache.annotation.CacheEvict; 7 | import org.springframework.cache.annotation.CachePut; 8 | import org.springframework.cache.annotation.Cacheable; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Isolation; 11 | import org.springframework.transaction.annotation.Propagation; 12 | import org.springframework.transaction.annotation.Transactional; 13 | import redis.clients.jedis.Jedis; 14 | 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | @Service("cacheServiceImpl") 19 | public class CacheServiceImpl implements MyService { 20 | 21 | @Cacheable(cacheNames = "redisCache",key = "'doSomething' + #param") 22 | @Override 23 | public String doSomething(String param) { 24 | System.out.println("===========" + param); 25 | return "=================" + param; 26 | } 27 | 28 | @CacheEvict(cacheNames = "content",key = "'doSomething' + #param") 29 | @Override 30 | public String throwTest(String param) { 31 | return null; 32 | } 33 | 34 | @CachePut(cacheNames = "content",key = "'doSomething' + #param") 35 | @Override 36 | public List queryContent(Map param) { 37 | return null; 38 | } 39 | 40 | @Override 41 | public int saveArea(ConsultConfigArea area) { 42 | return 0; 43 | } 44 | 45 | @Override 46 | public void saveTest(String param) { 47 | 48 | } 49 | 50 | @Override 51 | public void saveTest1(String param) { 52 | 53 | } 54 | 55 | @Override 56 | public void queryAllTest() { 57 | 58 | } 59 | 60 | @Cacheable(cacheNames = "mongoCache",key = "#user.uid") 61 | @Override 62 | public User queryUser(User user) { 63 | System.out.println("===========用户查询=========" + user.getUid()); 64 | return user; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/service/MyService.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.service; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.bean.ConsultContent; 5 | import com.zhuguang.jack.bean.User; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public interface MyService { 11 | public String doSomething(String param); 12 | 13 | public String throwTest(String param); 14 | 15 | List queryContent(Map param); 16 | 17 | public int saveArea(ConsultConfigArea area); 18 | 19 | public void saveTest(String param); 20 | 21 | public void saveTest1(String param); 22 | 23 | public void queryAllTest(); 24 | 25 | public User queryUser(User user); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/service/MyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.service; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.bean.ConsultContent; 5 | import com.zhuguang.jack.bean.User; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.jdbc.core.JdbcTemplate; 9 | import org.springframework.jdbc.core.RowMapper; 10 | import org.springframework.stereotype.Component; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Isolation; 13 | import org.springframework.transaction.annotation.Propagation; 14 | import org.springframework.transaction.annotation.Transactional; 15 | 16 | import java.sql.ResultSet; 17 | import java.sql.SQLException; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | @Service("myServiceImpl") 22 | public class MyServiceImpl implements MyService { 23 | 24 | @Autowired 25 | JdbcTemplate jdbcTemplate; 26 | 27 | @Autowired 28 | @Qualifier("annotationServiceImpl") 29 | MyService myService; 30 | 31 | public String doSomething(String param) { 32 | System.out.println("===================targetClass doSomething================="); 33 | return "===================targetClass doSomething================="; 34 | } 35 | 36 | @Override 37 | public String throwTest(String param) { 38 | throw new RuntimeException("异常================="); 39 | } 40 | 41 | @Override 42 | public List queryContent(Map param) { 43 | return null; 44 | } 45 | 46 | @Override 47 | public int saveArea(ConsultConfigArea area) { 48 | return 0; 49 | } 50 | 51 | @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED) 52 | @Override 53 | public void saveTest(String param) { 54 | try { 55 | String sql = "insert into test(num) values (?)"; 56 | int count = jdbcTemplate.update(sql, new Object[]{param}); 57 | myService.saveTest1(param); 58 | }catch (Exception e) { 59 | e.printStackTrace(); 60 | //必须要往上抛 61 | throw e; 62 | } 63 | } 64 | 65 | @Override 66 | public void saveTest1(String param) { 67 | } 68 | 69 | @Override 70 | public void queryAllTest() { 71 | String testsql = "select * from test"; 72 | System.out.println("=============test================"); 73 | jdbcTemplate.query(testsql, new RowMapper() { 74 | @Override 75 | public Map mapRow(ResultSet rs, int rowNum) throws SQLException { 76 | System.out.println(rs.getString("num")); 77 | return null; 78 | } 79 | }); 80 | String testsql1 = "select * from test1"; 81 | System.out.println("=============test1================"); 82 | jdbcTemplate.query(testsql1, new RowMapper() { 83 | @Override 84 | public Map mapRow(ResultSet rs, int rowNum) throws SQLException { 85 | System.out.println(rs.getString("num")); 86 | return null; 87 | } 88 | }); 89 | } 90 | 91 | @Override 92 | public User queryUser(User user) { 93 | return null; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/servlet/MyServlet.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.servlet; 2 | 3 | import javax.servlet.RequestDispatcher; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import java.io.IOException; 9 | 10 | public class MyServlet extends HttpServlet { 11 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 12 | this.doGet(request,response); 13 | } 14 | 15 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 16 | 17 | response.getWriter(); 18 | 19 | System.out.println("=================doget=========myServlet"); 20 | RequestDispatcher requestDispatcher = request.getRequestDispatcher("/WEB-INF/jsp/ok.jsp"); 21 | requestDispatcher.forward(request,response); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/smtransation/MyService.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.smtransation; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | 5 | public interface MyService { 6 | public int saveArea(ConsultConfigArea area); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/smtransation/MyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.smtransation; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.dao.CommonMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.transaction.PlatformTransactionManager; 7 | import org.springframework.transaction.TransactionDefinition; 8 | import org.springframework.transaction.TransactionStatus; 9 | 10 | public class MyServiceImpl implements MyService { 11 | 12 | private TransactionDefinition txDefinition; 13 | 14 | private PlatformTransactionManager txManager; 15 | 16 | @Autowired 17 | CommonMapper commonMapper; 18 | 19 | @Override 20 | public int saveArea(ConsultConfigArea area) { 21 | TransactionStatus transaction = txManager.getTransaction(txDefinition); 22 | try { 23 | transaction.createSavepoint(); 24 | commonMapper.saveArea(area); 25 | txManager.commit(transaction); 26 | } catch (Exception e) { 27 | txManager.rollback(transaction); 28 | } 29 | return 0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/springconfig/LoadProperties.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.springconfig; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; 5 | import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.Properties; 10 | 11 | public class LoadProperties extends PropertyPlaceholderConfigurer { 12 | 13 | private static Map proMap = new HashMap(); 14 | 15 | @Override 16 | protected void processProperties( 17 | ConfigurableListableBeanFactory beanFactoryToProcess, 18 | Properties props) throws BeansException { 19 | super.processProperties(beanFactoryToProcess, props); 20 | 21 | if (props != null) { 22 | for (Object key : props.keySet()) { 23 | String keyStr = key.toString(); 24 | String value = props.getProperty(keyStr); 25 | proMap.put(keyStr, value); 26 | } 27 | } 28 | } 29 | 30 | public static String getValue(String key) { 31 | return proMap.get(key); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/springconfig/LoadSpring.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.springconfig; 2 | 3 | import com.zhuguang.jack.testbean.Man; 4 | import com.zhuguang.jack.testbean.OriginClass; 5 | import com.zhuguang.jack.testbean.ShowSixClass; 6 | import org.springframework.context.support.ClassPathXmlApplicationContext; 7 | 8 | import java.io.IOException; 9 | 10 | public class LoadSpring { 11 | public static void main(String[] args) throws IOException { 12 | ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("classpath*:config/spring/applicationContext-core.xml"); 13 | 14 | 15 | ShowSixClass ss = (ShowSixClass)classPathXmlApplicationContext.getBean("people"); 16 | System.out.println(classPathXmlApplicationContext); 17 | 18 | OriginClass oc = (OriginClass)classPathXmlApplicationContext.getBean("originClass"); 19 | oc.method(); 20 | 21 | Man man = (Man)classPathXmlApplicationContext.getBean("man"); 22 | man.showsix(); 23 | 24 | // classPathXmlApplicationContext.getEnvironment().setActiveProfiles("product"); 25 | 26 | System.in.read(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/tag/MongoBeanDifinitionParser.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.tag; 2 | 3 | import org.springframework.beans.factory.support.BeanDefinitionBuilder; 4 | import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; 5 | import org.w3c.dom.Element; 6 | 7 | import com.mongodb.MongoClient; 8 | 9 | public class MongoBeanDifinitionParser extends 10 | AbstractSingleBeanDefinitionParser { 11 | 12 | protected String getParentName(Element element) { 13 | return super.getParentName(element); 14 | } 15 | 16 | protected Class getBeanClass(Element element) { 17 | return MongoClient.class; 18 | } 19 | 20 | protected void doParse(Element element, BeanDefinitionBuilder builder) { 21 | String ip = element.getAttribute("ip"); 22 | String port = element.getAttribute("port"); 23 | 24 | builder.addConstructorArgValue(ip); 25 | builder.addConstructorArgValue(port); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/tag/RedisBeanDifinitionParser.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.tag; 2 | 3 | import org.springframework.beans.factory.support.BeanDefinitionBuilder; 4 | import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; 5 | import org.w3c.dom.Element; 6 | 7 | import redis.clients.jedis.Jedis; 8 | 9 | public class RedisBeanDifinitionParser extends 10 | AbstractSingleBeanDefinitionParser { 11 | 12 | protected Class getBeanClass(Element element) { 13 | return Jedis.class; 14 | } 15 | 16 | protected void doParse(Element element, BeanDefinitionBuilder builder) { 17 | String ip = element.getAttribute("ip"); 18 | String port = element.getAttribute("port"); 19 | 20 | builder.addConstructorArgValue(ip); 21 | builder.addConstructorArgValue(Integer.parseInt(port)); 22 | } 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/tag/ServletConfigTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.tag; 2 | 3 | import org.springframework.web.context.ServletConfigAware; 4 | 5 | import javax.servlet.ServletConfig; 6 | 7 | public class ServletConfigTest implements ServletConfigAware { 8 | @Override 9 | public void setServletConfig(ServletConfig servletConfig) { 10 | servletConfig.getInitParameter(""); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/tag/TagsNamespaceHandler.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.tag; 2 | 3 | import org.springframework.beans.factory.config.BeanDefinitionHolder; 4 | import org.springframework.beans.factory.xml.NamespaceHandlerSupport; 5 | import org.springframework.beans.factory.xml.ParserContext; 6 | import org.w3c.dom.Node; 7 | 8 | public class TagsNamespaceHandler extends NamespaceHandlerSupport { 9 | 10 | public void init() { 11 | this.registerBeanDefinitionParser("mongo", 12 | new MongoBeanDifinitionParser()); 13 | this.registerBeanDefinitionParser("redis", 14 | new RedisBeanDifinitionParser()); 15 | } 16 | 17 | @Override 18 | public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) { 19 | return super.decorate(node, definition, parserContext); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/tag/Test.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.tag; 2 | 3 | import org.springframework.context.ApplicationContext; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | import redis.clients.jedis.Jedis; 6 | 7 | public class Test { 8 | 9 | public static void main(String[] args) { 10 | ApplicationContext app = new ClassPathXmlApplicationContext( 11 | "mytest.xml"); 12 | System.out.println(app); 13 | 14 | Jedis client1 = (Jedis)app.getBean("redis"); 15 | System.out.println(client1); 16 | 17 | System.out.println(client1.set("keyname1", "valuejack1")); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/test/Test.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.test; 2 | 3 | import com.zhuguang.jack.testbean.ListInjectTest; 4 | import com.zhuguang.jack.testbean.Son; 5 | import com.zhuguang.jack.typeConverter.TypeClass; 6 | import com.zhuguang.jack.typeConverter.TypeConverterTest; 7 | import org.springframework.context.ApplicationContext; 8 | import org.springframework.context.support.ClassPathXmlApplicationContext; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class Test { 14 | public static void main(String[] args) { 15 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:config" + 16 | "/spring/applicationContext-core.xml"); 17 | // context.setAllowBeanDefinitionOverriding(true); 18 | // context.setAllowCircularReferences(true); 19 | // context.refresh(); 20 | Son son = (Son) context.getBean("son"); 21 | System.out.println(son.getUsername() + ":" + son.getAge()); 22 | 23 | ListInjectTest injectTest = (ListInjectTest) context.getBean("injectTest"); 24 | TypeClass typeClass = (TypeClass) context.getBean("typeClass"); 25 | System.out.println(typeClass.getDate()); 26 | System.out.println(typeClass.getConsultRecord().getName()); 27 | 28 | List list = injectTest.getList(); 29 | if (list != null) { 30 | for (String o : list) { 31 | System.out.println("list : " + o); 32 | } 33 | } 34 | 35 | Map map = injectTest.getMap(); 36 | if (map != null) { 37 | System.out.println("======"); 38 | for (Map.Entry entry : map.entrySet()) { 39 | System.out.println(entry.getKey() + " : " + entry.getValue()); 40 | } 41 | } 42 | 43 | // prototypeTest(context); 44 | // prototypecircularreference(context); 45 | // requestScope(context); 46 | customScopeTest(context); 47 | } 48 | 49 | public static void prototypeTest(final ApplicationContext context) { 50 | for (int i = 0; i < 10; i++) { 51 | new Thread(new Runnable() { 52 | @Override 53 | public void run() { 54 | System.out.println(context.getBean("prototypeTest")); 55 | } 56 | }).start(); 57 | } 58 | } 59 | 60 | public static void prototypecircularreference(ApplicationContext context) { 61 | context.getBean("prototypeTestA"); 62 | context.getBean("prototypeTestB"); 63 | } 64 | 65 | public static void requestScope(ApplicationContext context) { 66 | Object scopeTest = context.getBean("scopeTest"); 67 | System.out.println(scopeTest); 68 | } 69 | 70 | public static void customScopeTest(final ApplicationContext context) { 71 | for (int i = 0; i < 10; i++) { 72 | new Thread(new Runnable() { 73 | @Override 74 | public void run() { 75 | for (int i1 = 0; i1 < 2; i1++) { 76 | System.out.println(Thread.currentThread().getId() + "-->" + context.getBean("customScopeBean")); 77 | } 78 | } 79 | }).start(); 80 | } 81 | 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/test/XX.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.test; 2 | 3 | import java.util.concurrent.*; 4 | 5 | public class XX { 6 | 7 | private static ExecutorService es = new ThreadPoolExecutor(50,100,0L,TimeUnit.MILLISECONDS, 8 | new LinkedBlockingDeque(100000)); 9 | 10 | public static void main(String[] args) throws InterruptedException { 11 | // for (int i = 0; i < 100000; i++) { 12 | // es.execute(new Runnable() { 13 | // @Override 14 | // public void run() { 15 | // System.out.println(1); 16 | // try { 17 | // Thread.sleep(1000); 18 | // } catch (InterruptedException e) { 19 | // e.printStackTrace(); 20 | // } 21 | // } 22 | // }); 23 | // } 24 | // 25 | // ThreadPoolExecutor tpe = (ThreadPoolExecutor)es; 26 | // while(true) { 27 | // System.out.println(); 28 | // int queueSize = tpe.getQueue().size(); 29 | // System.out.println("当前排队线程数:"+ queueSize); 30 | // 31 | // int activeCount = tpe.getActiveCount(); 32 | // System.out.println("当前活动线程数:" + activeCount); 33 | // 34 | // long completedThreadCount = tpe.getCompletedTaskCount(); 35 | // System.out.println("执行完成线程数:" + completedThreadCount); 36 | // 37 | // long taskCount = tpe.getTaskCount(); 38 | // System.out.println("总线程数:" + taskCount); 39 | // 40 | // Thread.sleep(3000); 41 | // } 42 | /*final CountDownLatch cdl = new CountDownLatch(5); 43 | long start = System.currentTimeMillis(); 44 | for (int i = 0; i < 5; i++) { 45 | new Thread(new Runnable() { 46 | @Override 47 | public void run() { 48 | try { 49 | Thread.sleep(3000); 50 | } catch (InterruptedException e) { 51 | e.printStackTrace(); 52 | }finally { 53 | //介绍一个线程就对发令枪减一,直到发令枪中的数字减到为0时,主程序才会从await处执行 54 | cdl.countDown(); 55 | } 56 | } 57 | }).start(); 58 | } 59 | 60 | cdl.await(); 61 | System.out.println(cdl.getCount()); 62 | System.out.println("线程执行耗时为:" + (System.currentTimeMillis() - start));*/ 63 | 64 | final CyclicBarrier cb = new CyclicBarrier(5, new Runnable() { 65 | @Override 66 | public void run() { 67 | System.out.println("cyclicBarrier finish"); 68 | } 69 | }); 70 | final long start = System.currentTimeMillis(); 71 | for (int i = 0; i < 10; i++) { 72 | new Thread(new Runnable() { 73 | @Override 74 | public void run() { 75 | try { 76 | Thread.sleep(1000); 77 | cb.await(); 78 | } catch (InterruptedException e) { 79 | e.printStackTrace(); 80 | } catch (BrokenBarrierException e) { 81 | e.printStackTrace(); 82 | } 83 | System.out.println("线程执行耗时:" + (System.currentTimeMillis() - start)); 84 | } 85 | }).start(); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/A.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | import org.springframework.beans.factory.InitializingBean; 4 | 5 | public class A implements InitializingBean { 6 | B b; 7 | 8 | public String username; 9 | 10 | public B getB() { 11 | return this.b; 12 | } 13 | 14 | public void setB(B b) { 15 | this.b = b; 16 | } 17 | 18 | public String getUsername() { 19 | return this.username; 20 | } 21 | 22 | public void setUsername(String username) { 23 | this.username = username; 24 | } 25 | 26 | @Override 27 | public void afterPropertiesSet() throws Exception { 28 | System.out.println("======afterPropertiesSet"); 29 | } 30 | 31 | public void initMethod() { 32 | System.out.println("======initMethod"); 33 | } 34 | 35 | // public A(B b) { 36 | // this.b = b; 37 | // } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/B.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class B { 4 | A a; 5 | 6 | public A getA() { 7 | return this.a; 8 | } 9 | 10 | public void setA(A a) { 11 | this.a = a; 12 | } 13 | 14 | // public B(A a) { 15 | // this.a = a; 16 | // } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/InnerClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class InnerClass { 4 | private String username; 5 | 6 | private int age; 7 | 8 | public String getUsername() { 9 | return this.username; 10 | } 11 | 12 | public void setUsername(String username) { 13 | this.username = username; 14 | } 15 | 16 | public int getAge() { 17 | return this.age; 18 | } 19 | 20 | public void setAge(int age) { 21 | this.age = age; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/ListInjectTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class ListInjectTest { 9 | 10 | public List list = new ArrayList(); 11 | 12 | public Map map = new HashMap(); 13 | 14 | public Map getMap() { 15 | return this.map; 16 | } 17 | 18 | public void setMap(Map map) { 19 | this.map = map; 20 | } 21 | 22 | public List getList() { 23 | return this.list; 24 | } 25 | 26 | public void setList(List list) { 27 | this.list = list; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/Man.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class Man implements People { 4 | 5 | // @Lazy 6 | // @Autowired 7 | Son son; 8 | 9 | @Override 10 | public void showsix() { 11 | System.out.println("i am man!"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/OriginClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class OriginClass { 4 | public void method() { 5 | System.out.println("I am origin method!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/OutClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class OutClass { 4 | private String username; 5 | 6 | private int age; 7 | 8 | private InnerClass innerClass; 9 | 10 | public String getUsername() { 11 | return this.username; 12 | } 13 | 14 | public void setUsername(String username) { 15 | this.username = username; 16 | } 17 | 18 | public int getAge() { 19 | return this.age; 20 | } 21 | 22 | public void setAge(int age) { 23 | this.age = age; 24 | } 25 | 26 | public InnerClass getInnerClass() { 27 | return this.innerClass; 28 | } 29 | 30 | public void setInnerClass(InnerClass innerClass) { 31 | this.innerClass = innerClass; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/Parent.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class Parent { 4 | private String username; 5 | 6 | private int age; 7 | 8 | public String getUsername() { 9 | return this.username; 10 | } 11 | 12 | public void setUsername(String username) { 13 | this.username = username; 14 | } 15 | 16 | public int getAge() { 17 | return this.age; 18 | } 19 | 20 | public void setAge(int age) { 21 | this.age = age; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/People.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public interface People { 4 | public void showsix(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/ReplaceClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | import org.springframework.beans.factory.support.MethodReplacer; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | public class ReplaceClass implements MethodReplacer { 8 | @Override 9 | public Object reimplement(Object obj, Method method, Object[] args) throws Throwable { 10 | System.out.println("I am replace method!"); 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/ShowSixClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public abstract class ShowSixClass { 4 | public void showsix() { 5 | getPeople().showsix(); 6 | } 7 | 8 | public abstract People getPeople(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/Son.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class Son { 4 | private String username; 5 | 6 | private int age; 7 | 8 | public String getUsername() { 9 | return this.username; 10 | } 11 | 12 | public void setUsername(String username) { 13 | this.username = username; 14 | } 15 | 16 | public int getAge() { 17 | return this.age; 18 | } 19 | 20 | public void setAge(int age) { 21 | this.age = age; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/Student.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class Student { 10 | 11 | public List list = new ArrayList() { 12 | { 13 | add("a"); 14 | add("b"); 15 | add("c"); 16 | } 17 | }; 18 | 19 | public String param; 20 | 21 | public Map map; 22 | 23 | public List mylist; 24 | 25 | @Autowired 26 | public TestServiceImpl service; 27 | 28 | public List getMylist() { 29 | return mylist; 30 | } 31 | 32 | public void setMylist(List mylist) { 33 | this.mylist = mylist; 34 | } 35 | 36 | public List getList() { 37 | return list; 38 | } 39 | 40 | public void setList(List list) { 41 | this.list = list; 42 | } 43 | 44 | public String getParam() { 45 | return param; 46 | } 47 | 48 | public void setParam(String param) { 49 | this.param = param; 50 | } 51 | 52 | public Map getMap() { 53 | return map; 54 | } 55 | 56 | public void setMap(Map map) { 57 | this.map = map; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/TestBean.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class TestBean { 4 | 5 | People people; 6 | 7 | public void show() { 8 | people.showsix(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/TestServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class TestServiceImpl { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/testbean/Woman.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.testbean; 2 | 3 | public class Woman implements People { 4 | @Override 5 | public void showsix() { 6 | System.out.println("i am woman"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/MyPropertyEditorRegistrar1.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import org.springframework.beans.PropertyEditorRegistrar; 4 | import org.springframework.beans.PropertyEditorRegistry; 5 | 6 | public class MyPropertyEditorRegistrar1 implements PropertyEditorRegistrar{ 7 | Class clazz; 8 | @Override 9 | public void registerCustomEditors(PropertyEditorRegistry registry) { 10 | registry.registerCustomEditor(clazz,new PropertyEditorTest()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/PropertyEditorTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import java.beans.PropertyEditorSupport; 4 | 5 | public class PropertyEditorTest extends PropertyEditorSupport { 6 | @Override 7 | public void setValue(Object value) { 8 | super.setValue(value); 9 | } 10 | 11 | @Override 12 | public Object getValue() { 13 | return super.getValue(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/StringToDateConverter.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | public class StringToDateConverter implements Converter { 10 | 11 | private String datePattern; 12 | 13 | public void setDatePattern(String datePattern) 14 | { 15 | this.datePattern = datePattern; 16 | } 17 | 18 | @Override 19 | public Date convert(String source) { 20 | System.out.println("==========StringToDateConverter"); 21 | SimpleDateFormat sf = new SimpleDateFormat(this.datePattern); 22 | try { 23 | Date d = sf.parse(source); 24 | return d; 25 | } catch (ParseException e) { 26 | e.printStackTrace(); 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/StringToObjectConverter.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import com.zhuguang.jack.bean.ConsultRecord; 4 | import org.springframework.core.convert.converter.Converter; 5 | 6 | public class StringToObjectConverter implements Converter { 7 | @Override 8 | public ConsultRecord convert(String source) { 9 | System.out.println("==============StringToObjectConverter"); 10 | ConsultRecord record = new ConsultRecord(); 11 | record.setName(source); 12 | return record; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/TypeClass.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import com.zhuguang.jack.bean.ConsultConfigArea; 4 | import com.zhuguang.jack.bean.ConsultRecord; 5 | 6 | import java.util.Date; 7 | 8 | public class TypeClass { 9 | public Date date; 10 | 11 | public ConsultRecord consultRecord; 12 | 13 | public ConsultConfigArea consultConfigArea; 14 | 15 | public ConsultConfigArea getConsultConfigArea() { 16 | return this.consultConfigArea; 17 | } 18 | 19 | public void setConsultConfigArea(ConsultConfigArea consultConfigArea) { 20 | this.consultConfigArea = consultConfigArea; 21 | } 22 | 23 | public ConsultRecord getConsultRecord() { 24 | return this.consultRecord; 25 | } 26 | 27 | public void setConsultRecord(ConsultRecord consultRecord) { 28 | this.consultRecord = consultRecord; 29 | } 30 | 31 | public Date getDate() { 32 | return this.date; 33 | } 34 | 35 | public void setDate(Date date) { 36 | this.date = date; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/zhuguang/jack/typeConverter/TypeConverterTest.java: -------------------------------------------------------------------------------- 1 | package com.zhuguang.jack.typeConverter; 2 | 3 | import org.springframework.beans.PropertyEditorRegistry; 4 | import org.springframework.beans.TypeConverter; 5 | import org.springframework.beans.TypeMismatchException; 6 | import org.springframework.core.MethodParameter; 7 | 8 | import java.beans.PropertyEditor; 9 | import java.lang.reflect.Field; 10 | 11 | public class TypeConverterTest implements TypeConverter,PropertyEditorRegistry { 12 | @Override 13 | public T convertIfNecessary(Object value, Class requiredType) throws TypeMismatchException { 14 | System.out.println("1"); 15 | return null; 16 | } 17 | 18 | @Override 19 | public T convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) throws TypeMismatchException { 20 | System.out.println("2"); 21 | return null; 22 | } 23 | 24 | @Override 25 | public T convertIfNecessary(Object value, Class requiredType, Field field) throws TypeMismatchException { 26 | System.out.println("3"); 27 | return null; 28 | } 29 | 30 | @Override 31 | public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor) { 32 | System.out.println("4"); 33 | } 34 | 35 | @Override 36 | public void registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor) { 37 | System.out.println("5"); 38 | } 39 | 40 | @Override 41 | public PropertyEditor findCustomEditor(Class requiredType, String propertyPath) { 42 | System.out.println("6"); 43 | return null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/aop.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/aopxml配置.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 47 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/bean属性.txt: -------------------------------------------------------------------------------- 1 | id:Bean的唯一标识名。它必须是合法的XMLID,在整个XML文档中唯一。 2 | 3 | (2)、name:用来为id创建一个或多个别名。它可以是任意的字母符合。多个别名之间用逗号或空格分开。 4 | 5 | (3)、class:用来定义类的全限定名(包名+类名)。只有子类Bean不用定义该属性。 6 | 7 | (4)、parent:子类Bean定义它所引用它的父类Bean。这时前面的class属性失效。子类Bean会继承父类Bean的所有属性,子类Bean也可以覆盖父类Bean的属性。注意:子类Bean和父类Bean是同一个Java类。 8 | 9 | (5)、abstract(默认为”false”):用来定义Bean是否为抽象Bean。它表示这个Bean将不会被实例化,一般用于父类Bean,因为父类Bean主要是供子类Bean继承使用。 10 | 11 | (6)、singleton(默认为“true”):定义Bean是否是Singleton(单例)。如果设为“true”,则在BeanFactory作用范围内,只维护此Bean的一个实例。如果设为“flase”,Bean将是Prototype(原型)状态,BeanFactory将为每次Bean请求创建一个新的Bean实例。 12 | 13 | (7)、lazy-init(默认为“default”):用来定义这个Bean是否实现懒初始化。如果为“true”,它将在BeanFactory启动时初始化所有的SingletonBean。反之,如果为“false”,它只在Bean请求时才开始创建SingletonBean。 14 | 15 | (8)、autowire(自动装配,默认为“default”):它定义了Bean的自动装载方式。 16 | 17 | 1、“no”:不使用自动装配功能。 18 | 19 | 2、“byName”:通过Bean的属性名实现自动装配。 20 | 21 | 3、“byType”:通过Bean的类型实现自动装配。 22 | 23 | 4、“constructor”:类似于byType,但它是用于构造函数的参数的自动组装。 24 | 25 | 5、“autodetect”:通过Bean类的反省机制(introspection)决定是使用“constructor” 26 | 27 | 还是使用“byType”。 28 | 29 | (9)、dependency-check(依赖检查,默认为“default”):它用来确保Bean组件通过JavaBean描述的所以依赖关系都得到满足。在与自动装配功能一起使用时,它特别有用。 30 | 31 | 1、none:不进行依赖检查。 32 | 33 | 2、objects:只做对象间依赖的检查。 34 | 35 | 3、simple:只做原始类型和String类型依赖的检查 36 | 37 | 4、all:对所有类型的依赖进行检查。它包括了前面的objects和simple。 38 | 39 | (10)、depends-on(依赖对象):这个Bean在初始化时依赖的对象,这个对象会在这个Bean初始化之前创建。 40 | 41 | (11)、init-method:用来定义Bean的初始化方法,它会在Bean组装之后调用。它必须是一个无参数的方法。 42 | 43 | (12)、destroy-method:用来定义Bean的销毁方法,它在BeanFactory关闭时调用。同样,它也必须是一个无参数的方法。它只能应用于singletonBean。 44 | 45 | (13)、factory-method:定义创建该Bean对象的工厂方法。它用于下面的“factory-bean”,表示这个Bean是通过工厂方法创建。此时,“class”属性失效。 46 | 47 | (14)、factory-bean:定义创建该Bean对象的工厂类。如果使用了“factory-bean”则“class”属性失效。 48 | 49 | (15)、autowire-candidate:采用xml格式配置bean时,将元素的autowire-candidate属性设置为false,这样容器在查找自动装配对象时,将不考虑该bean,即它不会被考虑作为其它bean自动装配的候选者,但是该bean本身还是可以使用自动装配来注入其它bean的。 -------------------------------------------------------------------------------- /src/main/resources/META-INF/component-scan配置: -------------------------------------------------------------------------------- 1 | 2 | annotation-config="true" 3 | name-generator="org.springframework.context.annotation.AnnotationBeanNameGenerator" 4 | resource-pattern="**/*.class" 5 | scope-resolver="org.springframework.context.annotation.AnnotationScopeMetadataResolver" 6 | scoped-proxy="no" 7 | use-default-filters="false" 8 | > 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/mytags.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationContextInitializer=com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags=com.zhuguang.jack.tag.TagsNamespaceHandler -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags.xsd=META-INF/mytags.xsd -------------------------------------------------------------------------------- /src/main/resources/config/core/core.properties: -------------------------------------------------------------------------------- 1 | jdbc.driverClassName = org.gjt.mm.mysql.Driver 2 | jdbc.url = jdbc:mysql://192.168.88.139:3307/zg 3 | jdbc.username = root 4 | jdbc.password = 123456 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/config/freemarker/freemarker.properties: -------------------------------------------------------------------------------- 1 | tag_syntax=auto_detect 2 | template_update_delay=2 3 | default_encoding=UTF-8 4 | output_encoding=UTF-8 5 | locale=zh_CN 6 | date_format=yyyy-MM-dd 7 | time_format=HH:mm:ss 8 | datetime_format=yyyy-MM-dd HH:mm:ss -------------------------------------------------------------------------------- /src/main/resources/config/mongodb/mongodb.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/src/main/resources/config/mongodb/mongodb.properties -------------------------------------------------------------------------------- /src/main/resources/config/redis/redis.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/src/main/resources/config/redis/redis.properties -------------------------------------------------------------------------------- /src/main/resources/config/spring/spring-freemarker.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 40 | 41 | 42 | 43 | *.ftl 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/resources/config/spring/spring-mongodb.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | classpath:config/mongodb/mongodb.properties 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/resources/config/spring/spring-redis.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | classpath:config/redis/redis.properties 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/config/spring/spring-velocity.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | text/html;charset=UTF-8 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/config/velocity/velocity.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/src/main/resources/config/velocity/velocity.properties -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | UTF-8 15 | 19 | 20 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 21 | 22 | 23 | 24 | 25 | 26 | UTF-8 27 | 28 | ${appName}.log 29 | 33 | 34 | 38 | ${appName}-%d{yyyy-MM-dd}-%i.log 39 | 44 | 365 45 | 48 | 49 | 100MB 50 | 51 | 52 | 55 | 56 | %d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n 57 | 58 | 59 | 60 | 66 | 67 | 70 | 71 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/main/resources/mytest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/ftls/home.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | user list 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <#list users as user> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
user list
IDnameage
${user.uid}${user.username}${user.password}
25 | 26 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/img/timg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/src/main/webapp/WEB-INF/img/timg.jpg -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fileUpload.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Administrator 4 | Date: 2019/1/25 5 | Time: 15:43 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | fileUpload 12 | 13 | 14 | 15 |
16 | 选择文件: 17 | 18 |
19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/ok.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Administrator 4 | Date: 2019/1/23 5 | Time: 23:43 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | ok 12 | 13 | 14 |

===============OK============

15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/vm/home.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |     5 |     show all users 6 | 7 | 8 |

单个名字:$user

9 |
10 |     遍历集合所得到的数据 11 |         #foreach($user in $users) 12 |             13 | 14 |                 15 |                 16 |             17 |         #end 18 |    
$user.uid$user.username$user.password
19 |    
20 | #set($directoryRoot = "www" ) 21 | #set($templateName = "index.vm" ) 22 | #set($template = "$directoryRoot/$templateName" ) 23 | 最终结果:$template 24 | 25 |    -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Archetype Created Web Application 7 | 8 | 9 | contextConfigLocation 10 | 11 | 12 | classpath:config/spring/applicationContext-core.xml 13 | 14 | 15 | 16 | webAppRootKey 17 | ServicePlatform.root 18 | 19 | 20 | 21 | globalInitializerClasses 22 | com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer 23 | 24 | 36 | 37 | allowBeanDefinitionOverriding 38 | true 39 | 40 | 41 | 42 | org.springframework.web.context.ContextLoaderListener 43 | 44 | 45 | 54 | 55 | cors 56 | com.zhuguang.jack.CorsFilter 57 | 58 | 59 | cors 60 | / 61 | 62 | 63 | 64 | spring-dispatcher 65 | org.springframework.web.servlet.DispatcherServlet 66 | 67 | 68 | contextConfigLocation 69 | classpath:config/spring/spring-dispatcher.xml 70 | 71 | 72 | detectAllHandlerMappings 73 | true 74 | 75 | 76 | contextInitializerClasses 77 | com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer 78 | 79 | 80 | allowBeanDefinitionOverriding 81 | true 82 | 83 | 0 84 | 85 | 86 | spring-dispatcher 87 | / 88 | 89 | 90 | 91 | MyServlet 92 | com.zhuguang.jack.servlet.MyServlet 93 | 0 94 | 95 | 96 | MyServlet 97 | /my 98 | 99 | 100 | 101 | 117 | 118 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/webapp/timg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/src/main/webapp/timg.jpg -------------------------------------------------------------------------------- /target/classes/META-INF/bean属性.txt: -------------------------------------------------------------------------------- 1 | id:Bean的唯一标识名。它必须是合法的XMLID,在整个XML文档中唯一。 2 | 3 | (2)、name:用来为id创建一个或多个别名。它可以是任意的字母符合。多个别名之间用逗号或空格分开。 4 | 5 | (3)、class:用来定义类的全限定名(包名+类名)。只有子类Bean不用定义该属性。 6 | 7 | (4)、parent:子类Bean定义它所引用它的父类Bean。这时前面的class属性失效。子类Bean会继承父类Bean的所有属性,子类Bean也可以覆盖父类Bean的属性。注意:子类Bean和父类Bean是同一个Java类。 8 | 9 | (5)、abstract(默认为”false”):用来定义Bean是否为抽象Bean。它表示这个Bean将不会被实例化,一般用于父类Bean,因为父类Bean主要是供子类Bean继承使用。 10 | 11 | (6)、singleton(默认为“true”):定义Bean是否是Singleton(单例)。如果设为“true”,则在BeanFactory作用范围内,只维护此Bean的一个实例。如果设为“flase”,Bean将是Prototype(原型)状态,BeanFactory将为每次Bean请求创建一个新的Bean实例。 12 | 13 | (7)、lazy-init(默认为“default”):用来定义这个Bean是否实现懒初始化。如果为“true”,它将在BeanFactory启动时初始化所有的SingletonBean。反之,如果为“false”,它只在Bean请求时才开始创建SingletonBean。 14 | 15 | (8)、autowire(自动装配,默认为“default”):它定义了Bean的自动装载方式。 16 | 17 | 1、“no”:不使用自动装配功能。 18 | 19 | 2、“byName”:通过Bean的属性名实现自动装配。 20 | 21 | 3、“byType”:通过Bean的类型实现自动装配。 22 | 23 | 4、“constructor”:类似于byType,但它是用于构造函数的参数的自动组装。 24 | 25 | 5、“autodetect”:通过Bean类的反省机制(introspection)决定是使用“constructor” 26 | 27 | 还是使用“byType”。 28 | 29 | (9)、dependency-check(依赖检查,默认为“default”):它用来确保Bean组件通过JavaBean描述的所以依赖关系都得到满足。在与自动装配功能一起使用时,它特别有用。 30 | 31 | 1、none:不进行依赖检查。 32 | 33 | 2、objects:只做对象间依赖的检查。 34 | 35 | 3、simple:只做原始类型和String类型依赖的检查 36 | 37 | 4、all:对所有类型的依赖进行检查。它包括了前面的objects和simple。 38 | 39 | (10)、depends-on(依赖对象):这个Bean在初始化时依赖的对象,这个对象会在这个Bean初始化之前创建。 40 | 41 | (11)、init-method:用来定义Bean的初始化方法,它会在Bean组装之后调用。它必须是一个无参数的方法。 42 | 43 | (12)、destroy-method:用来定义Bean的销毁方法,它在BeanFactory关闭时调用。同样,它也必须是一个无参数的方法。它只能应用于singletonBean。 44 | 45 | (13)、factory-method:定义创建该Bean对象的工厂方法。它用于下面的“factory-bean”,表示这个Bean是通过工厂方法创建。此时,“class”属性失效。 46 | 47 | (14)、factory-bean:定义创建该Bean对象的工厂类。如果使用了“factory-bean”则“class”属性失效。 48 | 49 | (15)、autowire-candidate:采用xml格式配置bean时,将元素的autowire-candidate属性设置为false,这样容器在查找自动装配对象时,将不考虑该bean,即它不会被考虑作为其它bean自动装配的候选者,但是该bean本身还是可以使用自动装配来注入其它bean的。 -------------------------------------------------------------------------------- /target/classes/META-INF/mytags.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /target/classes/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationContextInitializer=com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer -------------------------------------------------------------------------------- /target/classes/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags=com.zhuguang.jack.tag.TagsNamespaceHandler -------------------------------------------------------------------------------- /target/classes/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags.xsd=META-INF/mytags.xsd -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/App.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/App.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer1.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultConfigArea.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultConfigArea.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultContent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultContent.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultContract.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultContract.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultIdCardInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultIdCardInfo.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultRecord.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultRecord.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/ConsultRecordCount.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/ConsultRecordCount.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/Module.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/Module.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/Role.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/Role.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/bean/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/bean/User.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/dao/CommonMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/dao/CommonMapper.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/springconfig/LoadProperties.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/springconfig/LoadProperties.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/springconfig/LoadSpring.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/springconfig/LoadSpring.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/tag/MongoBeanDifinitionParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/tag/MongoBeanDifinitionParser.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/tag/RedisBeanDifinitionParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/tag/RedisBeanDifinitionParser.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/tag/TagsNamespaceHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/tag/TagsNamespaceHandler.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/tag/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/tag/Test.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/test/MyTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/test/MyTest.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/test/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/test/Test.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/Man.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/Man.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/OriginClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/OriginClass.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/People.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/People.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/ReplaceClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/ReplaceClass.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/ShowSixClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/ShowSixClass.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/Student$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/Student$1.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/Student.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/TestBean.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/TestBean.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/TestServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/TestServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/zhuguang/jack/testbean/Woman.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/classes/com/zhuguang/jack/testbean/Woman.class -------------------------------------------------------------------------------- /target/classes/config/core/core.properties: -------------------------------------------------------------------------------- 1 | jdbc.driverClassName = org.gjt.mm.mysql.Driver 2 | jdbc.url = jdbc:mysql://192.168.88.139:3307/zg 3 | jdbc.username = root 4 | jdbc.password = 123456 5 | 6 | -------------------------------------------------------------------------------- /target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | UTF-8 15 | 19 | 20 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 21 | 22 | 23 | 24 | 25 | 26 | UTF-8 27 | 28 | ${appName}.log 29 | 33 | 34 | 38 | ${appName}-%d{yyyy-MM-dd}-%i.log 39 | 44 | 365 45 | 48 | 49 | 100MB 50 | 51 | 52 | 55 | 56 | %d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n 57 | 58 | 59 | 60 | 66 | 67 | 70 | 71 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /target/classes/mytest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /target/spring-source-web/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Administrator 3 | Created-By: IntelliJ IDEA 4 | Build-Jdk: 1.7 5 | 6 | -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/META-INF/bean属性.txt: -------------------------------------------------------------------------------- 1 | id:Bean的唯一标识名。它必须是合法的XMLID,在整个XML文档中唯一。 2 | 3 | (2)、name:用来为id创建一个或多个别名。它可以是任意的字母符合。多个别名之间用逗号或空格分开。 4 | 5 | (3)、class:用来定义类的全限定名(包名+类名)。只有子类Bean不用定义该属性。 6 | 7 | (4)、parent:子类Bean定义它所引用它的父类Bean。这时前面的class属性失效。子类Bean会继承父类Bean的所有属性,子类Bean也可以覆盖父类Bean的属性。注意:子类Bean和父类Bean是同一个Java类。 8 | 9 | (5)、abstract(默认为”false”):用来定义Bean是否为抽象Bean。它表示这个Bean将不会被实例化,一般用于父类Bean,因为父类Bean主要是供子类Bean继承使用。 10 | 11 | (6)、singleton(默认为“true”):定义Bean是否是Singleton(单例)。如果设为“true”,则在BeanFactory作用范围内,只维护此Bean的一个实例。如果设为“flase”,Bean将是Prototype(原型)状态,BeanFactory将为每次Bean请求创建一个新的Bean实例。 12 | 13 | (7)、lazy-init(默认为“default”):用来定义这个Bean是否实现懒初始化。如果为“true”,它将在BeanFactory启动时初始化所有的SingletonBean。反之,如果为“false”,它只在Bean请求时才开始创建SingletonBean。 14 | 15 | (8)、autowire(自动装配,默认为“default”):它定义了Bean的自动装载方式。 16 | 17 | 1、“no”:不使用自动装配功能。 18 | 19 | 2、“byName”:通过Bean的属性名实现自动装配。 20 | 21 | 3、“byType”:通过Bean的类型实现自动装配。 22 | 23 | 4、“constructor”:类似于byType,但它是用于构造函数的参数的自动组装。 24 | 25 | 5、“autodetect”:通过Bean类的反省机制(introspection)决定是使用“constructor” 26 | 27 | 还是使用“byType”。 28 | 29 | (9)、dependency-check(依赖检查,默认为“default”):它用来确保Bean组件通过JavaBean描述的所以依赖关系都得到满足。在与自动装配功能一起使用时,它特别有用。 30 | 31 | 1、none:不进行依赖检查。 32 | 33 | 2、objects:只做对象间依赖的检查。 34 | 35 | 3、simple:只做原始类型和String类型依赖的检查 36 | 37 | 4、all:对所有类型的依赖进行检查。它包括了前面的objects和simple。 38 | 39 | (10)、depends-on(依赖对象):这个Bean在初始化时依赖的对象,这个对象会在这个Bean初始化之前创建。 40 | 41 | (11)、init-method:用来定义Bean的初始化方法,它会在Bean组装之后调用。它必须是一个无参数的方法。 42 | 43 | (12)、destroy-method:用来定义Bean的销毁方法,它在BeanFactory关闭时调用。同样,它也必须是一个无参数的方法。它只能应用于singletonBean。 44 | 45 | (13)、factory-method:定义创建该Bean对象的工厂方法。它用于下面的“factory-bean”,表示这个Bean是通过工厂方法创建。此时,“class”属性失效。 46 | 47 | (14)、factory-bean:定义创建该Bean对象的工厂类。如果使用了“factory-bean”则“class”属性失效。 48 | 49 | (15)、autowire-candidate:采用xml格式配置bean时,将元素的autowire-candidate属性设置为false,这样容器在查找自动装配对象时,将不考虑该bean,即它不会被考虑作为其它bean自动装配的候选者,但是该bean本身还是可以使用自动装配来注入其它bean的。 -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/META-INF/mytags.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationContextInitializer=com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags=com.zhuguang.jack.tag.TagsNamespaceHandler -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | http\://www.zhuguangedu.com/schema/mytags.xsd=META-INF/mytags.xsd -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/App.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/App.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/applicationContextInitializer/MyApplicationContextInitializer1.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultConfigArea.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultConfigArea.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultContent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultContent.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultContract.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultContract.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultIdCardInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultIdCardInfo.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultRecord.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultRecord.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultRecordCount.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/ConsultRecordCount.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/Module.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/Module.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/Role.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/Role.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/bean/User.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/dao/CommonMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/dao/CommonMapper.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/springconfig/LoadProperties.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/springconfig/LoadProperties.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/springconfig/LoadSpring.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/springconfig/LoadSpring.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/MongoBeanDifinitionParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/MongoBeanDifinitionParser.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/RedisBeanDifinitionParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/RedisBeanDifinitionParser.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/TagsNamespaceHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/TagsNamespaceHandler.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/tag/Test.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/test/MyTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/test/MyTest.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/test/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/test/Test.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Man.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Man.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/OriginClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/OriginClass.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/People.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/People.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/ReplaceClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/ReplaceClass.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/ShowSixClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/ShowSixClass.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Student$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Student$1.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Student.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/TestBean.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/TestBean.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/TestServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/TestServiceImpl.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Woman.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/classes/com/zhuguang/jack/testbean/Woman.class -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/config/core/core.properties: -------------------------------------------------------------------------------- 1 | jdbc.driverClassName = org.gjt.mm.mysql.Driver 2 | jdbc.url = jdbc:mysql://192.168.88.139:3307/zg 3 | jdbc.username = root 4 | jdbc.password = 123456 5 | 6 | -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | UTF-8 15 | 19 | 20 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 21 | 22 | 23 | 24 | 25 | 26 | UTF-8 27 | 28 | ${appName}.log 29 | 33 | 34 | 38 | ${appName}-%d{yyyy-MM-dd}-%i.log 39 | 44 | 365 45 | 48 | 49 | 100MB 50 | 51 | 52 | 55 | 56 | %d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n 57 | 58 | 59 | 60 | 66 | 67 | 70 | 71 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/classes/mytest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/ant-1.9.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/ant-1.9.6.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/ant-launcher-1.9.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/ant-launcher-1.9.6.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/asm-5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/asm-5.2.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/aspectjrt-1.8.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/aspectjrt-1.8.9.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/c3p0-0.9.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/c3p0-0.9.5.2.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/cglib-3.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/cglib-3.2.5.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/cglib-nodep-3.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/cglib-nodep-3.2.5.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/commons-pool2-2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/commons-pool2-2.3.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/fastjson-1.2.37.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/fastjson-1.2.37.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/jcl-over-slf4j-1.7.21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/jcl-over-slf4j-1.7.21.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/jedis-2.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/jedis-2.7.3.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/junit-4.12.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/log4j-1.2.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/log4j-1.2.16.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/logback-classic-1.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/logback-classic-1.1.2.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/logback-core-1.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/logback-core-1.1.2.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/mchange-commons-java-0.2.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/mchange-commons-java-0.2.11.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/mongo-java-driver-2.14.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/mongo-java-driver-2.14.3.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/mybatis-3.4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/mybatis-3.4.4.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/mybatis-spring-1.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/mybatis-spring-1.3.1.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/mysql-connector-java-5.1.25.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/mysql-connector-java-5.1.25.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/slf4j-api-1.7.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/slf4j-api-1.7.10.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/spring-data-commons-1.12.5.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/spring-data-commons-1.12.5.RELEASE.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/spring-data-mongodb-1.9.5.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/spring-data-mongodb-1.9.5.RELEASE.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/spring-data-mongodb-cross-store-1.9.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/spring-data-mongodb-cross-store-1.9.4.RELEASE.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/lib/spring-data-mongodb-log4j-1.9.5.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zg-jack/spring-source-web/36b6d0207066b368d88ba7190f5712380cd01f04/target/spring-source-web/WEB-INF/lib/spring-data-mongodb-log4j-1.9.5.RELEASE.jar -------------------------------------------------------------------------------- /target/spring-source-web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Archetype Created Web Application 7 | 8 | 9 | contextConfigLocation 10 | 11 | 12 | classpath:config/spring/applicationContext-core.xml 13 | 14 | 15 | 16 | webAppRootKey 17 | ServicePlatform.root 18 | 19 | 20 | 21 | globalInitializerClasses 22 | com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer 23 | 24 | 36 | 37 | allowBeanDefinitionOverriding 38 | true 39 | 40 | 41 | 42 | org.springframework.web.context.ContextLoaderListener 43 | 44 | 45 | 54 | 55 | cors 56 | com.zhuguang.jack.CorsFilter 57 | 58 | 59 | cors 60 | / 61 | 62 | 63 | 64 | spring-dispatcher 65 | org.springframework.web.servlet.DispatcherServlet 66 | 67 | 68 | contextConfigLocation 69 | classpath:config/spring/spring-dispatcher.xml 70 | 71 | 72 | detectAllHandlerMappings 73 | true 74 | 75 | 76 | contextInitializerClasses 77 | com.zhuguang.jack.applicationContextInitializer.MyApplicationContextInitializer 78 | 79 | 80 | allowBeanDefinitionOverriding 81 | true 82 | 83 | 0 84 | 85 | 86 | spring-dispatcher 87 | / 88 | 89 | 90 | 91 | MyServlet 92 | com.zhuguang.jack.servlet.MyServlet 93 | 0 94 | 95 | 96 | MyServlet 97 | /my 98 | 99 | 100 | 101 | 117 | 118 | -------------------------------------------------------------------------------- /target/spring-source-web/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | --------------------------------------------------------------------------------