欢迎使用CSDN-markdown编辑器
来源:互联网 发布:库里数据统计职业生涯 编辑:程序博客网 时间:2024/06/13 22:48
设计模式
3:抽象工厂模式的优缺点:
- (1) :分离接口和实现
client使用 抽象工厂来创建需要的对象,而client根本就不知道具体的实现是谁,client只是面向产品的接口编程而已,也就是说,client从具体的产品实现中解耦。 - (2) :使切换产品族变得容易
因为一个具体的工厂实现代表的是一个产品族,eg:Intel系列到AMD系列只需要切换一下具体工厂。
ps:抽象工厂模式的缺点是不太容易扩展新的产品。如果需要给整个产品族添加一个新的产品,那就需要修改抽象工厂,这样就会导致修改所有的工厂实现类。
4:单例模式的优缺点:
- (1) :实现方式
控制一个类只被创建一个实例,问题就是要把创建实例的权限收回来,让类自身来负责,自己类实例的创建工作,然后由这个类来提供,外部可以访问这个类实例的方法。 - (1) :分离接口和实现
client使用 抽象工厂来创建需要的对象,而client根本就不知道具体的实现是谁,client只是面向产品的接口编程而已,也就是说,client从具体的产品实现中解耦。 - (2) :使切换产品族变得容易
因为一个具体的工厂实现代表的是一个产品族,eg:Intel系列到AMD系列只需要切换一下具体工厂。
ps:抽象工厂模式的缺点是不太容易扩展新的产品。如果需要给整个产品族添加一个新的产品,那就需要修改抽象工厂,这样就会导致修改所有的工厂实现类。
快捷键
- 加粗
Ctrl + B
- 斜体
Ctrl + I
- 引用
Ctrl + Q
- 插入链接
Ctrl + L
- 插入代码
Ctrl + K
- 插入图片
Ctrl + G
- 提升标题
Ctrl + H
- 有序列表
Ctrl + O
- 无序列表
Ctrl + U
- 横线
Ctrl + R
- 撤销
Ctrl + Z
- 重做
Ctrl + Y
Markdown及扩展
2017-08-24 11:15:21.772 INFO 2996 — [ main] c.extracme.volvopark.netty.ServerStart : Starting ServerStart on DESKTOP-CBAH040 with PID 2996 (D:\java\space\evspring\volvo-tcpserver\target\classes started by alex in D:\java\space\evspring\volvo-tcpserver)
2017-08-24 11:15:21.772 INFO 2996 — [ main] c.extracme.volvopark.netty.ServerStart : No active profile set, falling back to default profiles: default
2017-08-24 11:15:21.819 INFO 2996 — [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@421dc8c8: startup date [Thu Aug 24 11:15:21 CST 2017]; root of context hierarchy
2017-08-24 11:15:22.600 INFO 2996 — [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [spring.xml]
2017-08-24 11:15:22.707 INFO 2996 — [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [spring-mybatis.xml]
2017-08-24 11:15:22.848 INFO 2996 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean ‘beanNameViewResolver’ with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfigurationWhitelabelErrorViewConfiguration;factoryMethodName=beanNameViewResolver;initMethodName=null;destroyMethodName=(inferred);definedinclasspathresource[org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfigurationWebMvcAutoConfigurationAdapter;factoryMethodName=beanNameViewResolver;initMethodName=null;destroyMethodName=(inferred);definedinclasspathresource[org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration WebMvcAutoConfigurationAdapter.class]]
2017-08-24 11:15:22.912 WARN 2996 — [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in ‘[com.extracme.volvopark.netty]’ package. Please check your configuration.
2017-08-24 11:15:23.373 INFO 2996 — [ main] o.s.b.f.c.PropertyPlaceholderConfigurer : Loading properties file from class path resource [application.properties]
2017-08-24 11:15:23.483 INFO 2996 — [ main] trationDelegateBeanPostProcessorChecker:Bean‘org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration′oftype[classorg.springframework.transaction.annotation.ProxyTransactionManagementConfiguration EnhancerBySpringCGLIB b37dacf1]isnoteligibleforgettingprocessedbyallBeanPostProcessors(forexample:noteligibleforauto−proxying)2017−08−2411:15:23.971INFO2996—[main]s.b.c.e.t.TomcatEmbeddedServletContainer:Tomcatinitializedwithport(s):8090(http)2017−08−2411:15:23.980INFO2996—[main]o.apache.catalina.core.StandardService:StartingserviceTomcat2017−08−2411:15:23.981INFO2996—[main]org.apache.catalina.core.StandardEngine:StartingServletEngine:ApacheTomcat/8.0.322017−08−2411:15:24.059INFO2996—[ost−startStop−1]o.a.c.c.C.[Tomcat].[localhost].[/]:InitializingSpringembeddedWebApplicationContext2017−08−2411:15:24.059INFO2996—[ost−startStop−1]o.s.web.context.ContextLoader:RootWebApplicationContext:initializationcompletedin2240ms2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.e.ServletRegistrationBean:Mappingservlet:‘dispatcherServlet′to[/]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘metricFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘characterEncodingFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘hiddenHttpMethodFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘httpPutFormContentFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘requestContextFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘webRequestLoggingFilter′to:[/∗]2017−08−2411:15:24.421INFO2996—[ost−startStop−1]o.s.b.c.embedded.FilterRegistrationBean:Mappingfilter:‘applicationContextIdFilter′to:[/∗]2017−08−2411:15:24.577INFO2996—[main]com.alibaba.druid.pool.DruidDataSource:dataSource−1inited2017−08−2411:15:24.749INFO2996—[main]o.s.s.concurrent.ThreadPoolTaskExecutor:InitializingExecutorService‘sendEmailExecutor′2017−08−2411:15:24.765WARN2996—[main]ationConfigEmbeddedWebApplicationContext:Exceptionencounteredduringcontextinitialization−cancellingrefreshattempt:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname‘stakeMsgHandler′:Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.extracme.volvopark.netty.service.MsgControllercom.extracme.volvopark.netty.server.StakeMsgHandler.MsgController;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname‘msgController′:Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:com.extracme.volvopark.netty.iservice.IMsgServicecom.extracme.volvopark.netty.service.MsgController.msgService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname‘msgService′:Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.extracme.volvopark.netty.service.BrakeServicecom.extracme.volvopark.netty.service.MsgService.brakeService;nestedexceptionisjava.lang.IllegalArgumentException:Cannotsetcom.extracme.volvopark.netty.service.BrakeServicefieldcom.extracme.volvopark.netty.service.MsgService.brakeServicetocom.sun.proxy. Proxy62
2017-08-24 11:15:24.765 INFO 2996 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService ‘sendEmailExecutor’
2017-08-24 11:15:24.765 INFO 2996 — [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
2017-08-24 11:15:24.765 INFO 2996 — [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-08-24 11:15:24.780 ERROR 2996 — [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘stakeMsgHandler’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.MsgController com.extracme.volvopark.netty.server.StakeMsgHandler.MsgController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.extracme.volvopark.netty.ServerStart.main(ServerStart.java:17)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.MsgController com.extracme.volvopark.netty.server.StakeMsgHandler.MsgController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
… 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.extracme.volvopark.netty.iservice.IMsgService com.extracme.volvopark.netty.service.MsgController.msgService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘msgService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory
… 32 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.extracme.volvopark.netty.service.BrakeService com.extracme.volvopark.netty.service.MsgService.brakeService; nested exception is java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
… 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Can not set com.extracme.volvopark.netty.service.BrakeService field com.extracme.volvopark.netty.service.MsgService.brakeService to com.sun.proxy.
… 45 common frames omitted
2017-08-24 11:15:24.796 INFO 2996 — [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-2} inited
2017-08-24 11:15:24.812 WARN 2996 — [ main] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean ‘dataSource’ while setting bean property ‘dataSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSourceInitializer’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.jdbc.DataSourceProperties org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.properties; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘spring.datasource.CONFIGURATION_PROPERTIES’: Initialization of bean failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@421dc8c8 has not been refreshed yet)
今天spring boot 加载一直报
No MyBatis mapper was found in ‘[com.extracme.volvopark.netty]’ package. Please check your configuration.
还以为是配置问题,最后解决方案是:注入的时候把接口的实现类注入了,
原: @Autowired
private BrakeService brakeService;
正确:
@Autowired
private IBrakeService brakeService;
ps:IBrakeService .class是接口;BrakeService 是其实现类
使用简单的符号标识不同的标题,将某些文字标记为粗体或者斜体,创建一个链接等,详细语法参考帮助?。
本编辑器支持 Markdown Extra , 扩展了很多好用的功能。具体请参考Github.
表格
Markdown Extra 表格语法:
可以使用冒号来定义对齐方式:
定义列表
- Markdown Extra 定义列表语法:
- 项目1
- 项目2
- 定义 A
- 定义 B
- 项目3
- 定义 C
定义 D
定义D内容
代码块
代码块语法遵循标准markdown代码,例如:
@requires_authorizationdef somefunc(param1='', param2=0): '''A docstring''' if param1 > param2: # interesting print 'Greater' return (param2 - param1 + 1) or Noneclass SomeClass: pass>>> message = '''interpreter... prompt'''
脚注
生成一个脚注1.
目录
用 [TOC]
来生成目录:
- 设计模式
- 3抽象工厂模式的优缺点
- 4单例模式的优缺点
- ps抽象工厂模式的缺点是不太容易扩展新的产品如果需要给整个产品族添加一个新的产品那就需要修改抽象工厂这样就会导致修改所有的工厂实现类
- 快捷键
- Markdown及扩展
- 表格
- 定义列表
- 代码块
- 脚注
- 目录
- 数学公式
- UML 图
- 离线写博客
- 浏览器兼容
数学公式
使用MathJax渲染LaTex 数学公式,详见math.stackexchange.com.
- 行内公式,数学公式为:
Γ(n)=(n−1)!∀n∈N 。 - 块级公式:
更多LaTex语法请参考 这儿.
UML 图:
可以渲染序列图:
或者流程图:
- 关于 序列图 语法,参考 这儿,
- 关于 流程图 语法,参考 这儿.
离线写博客
即使用户在没有网络的情况下,也可以通过本编辑器离线写博客(直接在曾经使用过的浏览器中输入write.blog.csdn.net/mdeditor即可。Markdown编辑器使用浏览器离线存储将内容保存在本地。
用户写博客的过程中,内容实时保存在浏览器缓存中,在用户关闭浏览器或者其它异常情况下,内容不会丢失。用户再次打开浏览器时,会显示上次用户正在编辑的没有发表的内容。
博客发表后,本地缓存将被删除。
用户可以选择 把正在写的博客保存到服务器草稿箱,即使换浏览器或者清除缓存,内容也不会丢失。
注意:虽然浏览器存储大部分时候都比较可靠,但为了您的数据安全,在联网后,请务必及时发表或者保存到服务器草稿箱。
浏览器兼容
- 目前,本编辑器对Chrome浏览器支持最为完整。建议大家使用较新版本的Chrome。
- IE9以下不支持
- IE9,10,11存在以下问题
- 不支持离线功能
- IE9不支持文件导入导出
- IE10不支持拖拽文件导入
- 这里是 脚注 的 内容. ↩
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- java 基础三
- 2017年9月24笔记
- Oracle12C--管理触发器(59)
- php中常用的字符串获取函数mb_strcut实例解释
- 谷歌和火狐浏览器下的input的padding不同表现
- 欢迎使用CSDN-markdown编辑器
- Docker、kubernetes和Mesos及Docker网络基础
- 380.Insert Delete GetRandom O(1) 常数时间内插入删除和获得随机数
- 浏览器 HTTP 协议缓存机制详解
- 进程间的通信—管道pipe和fifo
- Spark Hadoop Free 安装遇到的问题
- HTTP详解--响应首部字段(11)
- Android自定义View之属性解析
- Http详解--实体首部字段(12)