springBoot整合dubbo的能否配置在消费先启动后再启动提供者能让服务注入进去。

就像这时候在提供者还未启动时,这个对象是空的就算后面dubbo检查到提供者以启动了,但是这个消费者还是空的没办法注入值
就像这时候在提供者还未启动时,这个对象是空的就算后面dubbo检查到提供者以启动了,但是这个消费者还是空的没办法注入值.
这样就有了个启动顺序在。运维那群人就不想(#><)

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
整合springboot+dubbo优雅关机的相关问题

有几个问题想跟大家交流下: 1.在正式环境中,是通过dubbo的com.alibaba.dubbo.container.Main启动服务 还是用springboot的容器来启动服务呢? 2.用springboot启动该如何实现优雅关机呢? 3.用dubbo Main启动又是怎么去加载application.yml文件的? 4.dubbo Main是通过读取spring配置文件来启动容器,而springboot的宗旨是零配置启动项目,基于这点,springboot对于dubbo的支持是不是就没那么好了

springboot整合dubbo,注册服务。启动时报这个错误,怎么回事呢?

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.0.RELEASE) 2020-05-03 23:34:12.084 INFO 1156 --- [ main] com.provider.DemoApplication : Starting DemoApplication on u-PC with PID 1156 (D:\springboot-dubbo-test\provider\target\classes started by u in D:\springboot-dubbo-test) 2020-05-03 23:34:12.084 INFO 1156 --- [ main] com.provider.DemoApplication : No active profile set, falling back to default profiles: default 2020-05-03 23:34:12.672 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : com.alibaba.dubbo.config.ApplicationConfig#0, class : com.alibaba.dubbo.config.ApplicationConfig] has been registered. 2020-05-03 23:34:12.674 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : com.alibaba.dubbo.config.ApplicationConfig#0] has been registered. 2020-05-03 23:34:12.674 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : com.alibaba.dubbo.config.RegistryConfig#0, class : com.alibaba.dubbo.config.RegistryConfig] has been registered. 2020-05-03 23:34:12.674 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : com.alibaba.dubbo.config.RegistryConfig#0] has been registered. 2020-05-03 23:34:12.674 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : com.alibaba.dubbo.config.ProtocolConfig#0, class : com.alibaba.dubbo.config.ProtocolConfig] has been registered. 2020-05-03 23:34:12.675 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : com.alibaba.dubbo.config.ProtocolConfig#0] has been registered. 2020-05-03 23:34:12.675 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : com.alibaba.dubbo.config.MonitorConfig#0, class : com.alibaba.dubbo.config.MonitorConfig] has been registered. 2020-05-03 23:34:12.675 INFO 1156 --- [ main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : com.alibaba.dubbo.config.MonitorConfig#0] has been registered. 2020-05-03 23:34:12.722 ERROR 1156 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang.IllegalStateException: Error processing condition on com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointAutoConfiguration.dubboEndpoint at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:181) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at com.provider.DemoApplication.main(DemoApplication.java:12) [classes/:na] Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.validate(OnBeanCondition.java:451) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:441) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:416) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:158) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] ... 16 common frames omitted Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointAutoConfiguration.dubboEndpoint at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:496) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanType(OnBeanCondition.java:483) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:435) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] ... 19 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/actuate/endpoint/AbstractEndpoint at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_131] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_131] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_131] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_131] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_131] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_131] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_131] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_131] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131] at java.lang.Class.forName0(Native Method) ~[na:1.8.0_131] at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_131] at org.springframework.util.ClassUtils.forName(ClassUtils.java:275) ~[spring-core-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.getReturnType(OnBeanCondition.java:505) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:491) ~[spring-boot-autoconfigure-2.1.0.RELEASE.jar:2.1.0.RELEASE] ... 21 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.endpoint.AbstractEndpoint at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131] ... 38 common frames omitted Process finished with exit code 1

springboot整合dubbo服务启动报错

SpringBoot1.5.1,Dubbo 2..8.4,JDK 1.8.0_171 zookeeper确定是启动的。 provider配置如下: ``` <!--定义了提供方应用信息,用于计算依赖关系;在 dubbo-admin 或 dubbo-monitor 会显示这个名字,方便辨识--> <dubbo:application name="demotest-provider" owner="programmer" organization="dubbox"/> <!--使用 zookeeper 注册中心暴露服务,注意要先开启 zookeeper--> <dubbo:registry address="zookeeper://localhost:2181"/> <!-- 用dubbo协议在20880端口暴露服务 --> <dubbo:protocol name="dubbo" port="20880" /> <!--使用 dubbo 协议实现定义好的接口--> <dubbo:service interface="cn.kaison.xblog.system.api.service.SystemService" ref="systemService" protocol="dubbo"></dubbo:service> <!--具体实现该接口的 bean--> <bean id="demoService" class="cn.kaison.xblog.system.provider.serviceImpl.SystemServiceImpl"></bean> ``` 项目结构: ![图片说明](https://img-ask.csdn.net/upload/201804/20/1524156832_387407.png) 启动后报错如下: 2018-04-20 00:43:04.775 WARN 18261 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cn.kaison.xblog.system.api.service.SystemService': Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError 2018-04-20 00:43:04.779 WARN 18261 --- [ main] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name 'cn.kaison.xblog.system.api.service.SystemService': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.dubbo.config.spring.ServiceBean) 2018-04-20 00:43:04.789 ERROR 18261 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cn.kaison.xblog.system.api.service.SystemService': Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE] at cn.kaison.xblog.system.provider.SysProviderApplication.main(SysProviderApplication.java:30) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na] Caused by: java.lang.ExceptionInInitializerError: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE] ... 20 common frames omitted Caused by: java.lang.IllegalStateException: fail to create adaptive instance: java.lang.IllegalStateException: Can not create adaptive extenstion interface com.alibaba.dubbo.rpc.Protocol, cause: Failed to load extension class(interface: interface com.alibaba.dubbo.common.compiler.Compiler, class line: com.alibaba.dubbo.common.compiler.support.JavassistCompiler) in jar:file:/Users/xiaohuchen/Documents/_my_soft/mavenrepo/com/alibaba/dubbo/2.8.4/dubbo-2.8.4.jar!/META-INF/dubbo/internal/com.alibaba.dubbo.common.compiler.Compiler, cause: javassist/ClassPath at com.alibaba.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:459) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.config.ServiceConfig.<clinit>(ServiceConfig.java:62) ~[dubbo-2.8.4.jar:2.8.4] ... 27 common frames omitted Caused by: java.lang.IllegalStateException: Can not create adaptive extenstion interface com.alibaba.dubbo.rpc.Protocol, cause: Failed to load extension class(interface: interface com.alibaba.dubbo.common.compiler.Compiler, class line: com.alibaba.dubbo.common.compiler.support.JavassistCompiler) in jar:file:/Users/xiaohuchen/Documents/_my_soft/mavenrepo/com/alibaba/dubbo/2.8.4/dubbo-2.8.4.jar!/META-INF/dubbo/internal/com.alibaba.dubbo.common.compiler.Compiler, cause: javassist/ClassPath at com.alibaba.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:723) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:455) ~[dubbo-2.8.4.jar:2.8.4] ... 28 common frames omitted Caused by: java.lang.IllegalStateException: Failed to load extension class(interface: interface com.alibaba.dubbo.common.compiler.Compiler, class line: com.alibaba.dubbo.common.compiler.support.JavassistCompiler) in jar:file:/Users/xiaohuchen/Documents/_my_soft/mavenrepo/com/alibaba/dubbo/2.8.4/dubbo-2.8.4.jar!/META-INF/dubbo/internal/com.alibaba.dubbo.common.compiler.Compiler, cause: javassist/ClassPath at com.alibaba.dubbo.common.extension.ExtensionLoader.loadFile(ExtensionLoader.java:685) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.loadExtensionClasses(ExtensionLoader.java:591) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.getExtensionClasses(ExtensionLoader.java:567) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.getAdaptiveExtensionClass(ExtensionLoader.java:728) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:721) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:455) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.createAdaptiveExtensionClass(ExtensionLoader.java:738) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.getAdaptiveExtensionClass(ExtensionLoader.java:732) ~[dubbo-2.8.4.jar:2.8.4] at com.alibaba.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:721) ~[dubbo-2.8.4.jar:2.8.4] ... 29 common frames omitted Caused by: java.lang.NoClassDefFoundError: javassist/ClassPath at java.lang.Class.forName0(Native Method) ~[na:1.8.0_144] at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_144] at com.alibaba.dubbo.common.extension.ExtensionLoader.loadFile(ExtensionLoader.java:627) ~[dubbo-2.8.4.jar:2.8.4] ... 37 common frames omitted Caused by: java.lang.ClassNotFoundException: javassist.ClassPath at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144] ... 40 common frames omitted

springboot+dubbo在写单元测试的时候controller中的@Reference注解属性为null

问题描述 项目中运用springboot+dubbo注解方式的配置开发,正常启动项目没有什么问题,但是当我在写单元测试的时候,发现@Reference标注的属性为null,导致调用空指针异常. 相关代码 待测试方法: ``` @RestController @RequestMapping("/api/user") public class UserController { @Reference(version = "${dubbo.service.version}") private IUserService userService; @PostMapping(value="/login", produces="application/json;charset=UTF-8") public JsonApi login(String username, String password) { User search = new User(); search.setUsername(username); User user = userService.selectUserBy(search); if (StringUtils.isEmpty(user)){ search.setUsername(null); search.setEmail(username); user = userService.selectUserBy(search); } if (StringUtils.isEmpty(user)){ throw new AuthorizeException(ErrorCode.USER_UNKNOWN_ACCOUNT); } return JsonApi.isOk()..data(user); } } ``` 测试方法: ``` @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @SpringBootTest public class UserControllerTest { private MockMvc mvc; @Before public void setUp() { mvc = MockMvcBuilders.standaloneSetup(new UserController()).build(); } @Test public void login() throws Exception { RequestBuilder request = post("/api/user/login") .contentType(MediaType.APPLICATION_JSON) .param("username","test") .param("password","123456"); String rs = mvc.perform(request) //.andDo(print()) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(rs); } } ``` 在运行测试用例的时候,发现private IUserService userService为空 ![图片说明](https://img-ask.csdn.net/upload/201809/26/1537953108_564995.png) 网上都是说和springMvc集成的时候加载顺序会导致这个空指针异常,但是我的项目正常启动是可以访问的,就是在测试用例的时候回出现空,不知道什么原因. 是哪里的配置没有配置对吗?

dubbo中服务提供者和消费者在一个应用中也是远程调用吗?

标准springboot代码,接口实现类上标注@Service注解,controller引用则标注@Autowired自动注入,controller和service在一个应用中。 1、现在要引入dubbo,那么接口实现类上加Dubbo的@Service注解,原来的springboot的注解还保留吗? 2、在调用的地方,如果把@Autowired换成dubbo的@Reference,提供者和消费者在一个应用中,是直接调用还是走rpc呢? 3、部署应用时,根据资源情况,有可能实现类和调用打包到一个应用中,也可能打包到不同应用中走rpc调用,是否调用处同时标注springboot的@Autowired和dubbo的@Reference呢?总之,我希望代码不动能同时支持两种情况,谢谢!

dubbo+Springboot把jar包推到云服务器之后,zookeeper报错UnresolvedAddressException: null

问题是这样的,我买了个云服务器,想跑Springboot+dubbo的代码,这边是服务端。 Zookeeper做注册中心,是放在服务器上的,成功启动了,而且我在本地直接用IDEA跑jar包也没有任何问题。 但是!!!我把jar传上linux服务器之后启动,就出现了这个: ![图片说明](https://img-ask.csdn.net/upload/202004/15/1586933523_930013.png) 本地是正常的,ip/ip:2181这种 我就想知道 这个<unresolved> 是咋回事???!!! 疯了!!!我晕了,Web项目就OK,正常启动了。这两个项目不同的地方在于web使用了springboot的Parent,而dubbo服务是我手动配置然后repackage打包的, 可能需要自己跟进一下后续

dubbo2.6.6+zookeeper0.11+springboot2.0.0报错

com.alibaba.dubbo.rpc.RpcException: Fail to start server (url: dubbo://169.254.169.71:20880/com.wz.springboot.dubbo.zookeeper.maven.demo.api.service.UserService?anyhost=true&application=provider&bean.name=com.wz.springboot.dubbo.zookeeper.maven.demo.api.service.UserService&bind.ip=169.254.169.71&bind.port=20880&channel.readonly.sent=true&codec=dubbo&dubbo=2.0.2&generic=false&heartbeat=60000&interface=com.wz.springboot.dubbo.zookeeper.maven.demo.api.service.UserService&methods=findUser&pid=4512&side=provider&timestamp=1560308343938) Failed to bind NettyServer on /169.254.169.71:20880, cause: io/netty/bootstrap/ServerBootstrap

dubbo如何将服务方和消费方整合到同一个模块?

我看到公司的项目将服务方和消费方整合到了一个模块的不同module,service在spi的module,然后通过rpc的方式进行调用,同时这个模块的service还可以被其他模块通过springboot注解调用,感觉又方便又优雅,但是框架整合的太麻烦了,想请问下是如何做出来的?有没有人可以提供一个最简单的demo

springboot 整合dubbox,采用外部应用服务器的servlet容器配置问题

<dubbo:protocol name="rest" server="servlet"/>在使用该配置使用外部容器时,官方说明: 如果你是用spring的ContextLoaderListener来加载spring,则必须保证BootstrapListener配置在ContextLoaderListener之前,否则dubbo初始化会出错。 是否有大神能够指导如何实现这个配置保证BootstrapListener在ContextLoaderListener之前完成配置?

关于Dubbo配置的问题~ spring整合Dubbo出现问题。

![图片说明](https://img-ask.csdn.net/upload/201704/05/1491383979_484380.png) 首先,在没有添加这段代码前 ![图片说明](https://img-ask.csdn.net/upload/201704/05/1491384001_58968.png) tomcat 报了如上错误| ↑ | 貌似是jar包冲突了?我的问题1:为什么会报这个错?(框架是ssm)【添加了那段代码后,项目正常启动。】 ![图片说明](https://img-ask.csdn.net/upload/201704/05/1491384164_16351.png) 问题2: 这是dubbo的配置文件 , tomcat启动报了如下的错误,貌似是找不到端口。这个配置文件正确的写法应该是?????( 注:当删除这个配置文件的时候,项目可以正常启动 注2:192.168.2.129:2181这个也是没错的,会不会是防火墙的问题?) ![图片说明](https://img-ask.csdn.net/upload/201704/05/1491384213_628095.png)

springboot整合了dubbo后 运行出Failed to bind properties under 'spring.dubbo.protocol' to com.alibaba.dubbo.config.ProtocolConfig:

![图片说明](https://img-ask.csdn.net/upload/202003/02/1583078781_129000.png)

springmvc+dubbo 启动过程几点问题,求解答

springmvc中引入dubbo的配置文件后,在启动web容器的时候会加载dubbo的配置文件 并由dubbo的解释器进行解析xml配置,装配到spring容器,问题来了,问题1:我并没有启动dubbo的服务,dubbo是怎么启动的?问题2:dubbo的启动是通过com.alibaba.dubbo.container.Main中的main方法启动的,源码中是在main方法中又启动了一个SpringContainer,这里的Main是谁来调用的?问题3:以上过程中是不是启动了两spring容器?

dubbo 消费者注册不上zookeeper

spring启动后不报错 dubbo-admin后台上没显示 dubbo配置文件: ![图片说明](https://img-ask.csdn.net/upload/201905/29/1559101464_166270.png) <br>spring启动引用: ![图片说明](https://img-ask.csdn.net/upload/201905/29/1559101600_751608.png) </br>pom.xml依赖 ![图片说明](https://img-ask.csdn.net/upload/201905/29/1559101883_351961.png) 启动后日志打印 已经加载xml了 并没有报错 ![图片说明](https://img-ask.csdn.net/upload/201905/29/1559102050_180381.png) </br> </br> dubbo-admin上消费者没有 ![图片说明](https://img-ask.csdn.net/upload/201905/29/1559102167_110776.png)

hessian在springboot项目下具体的应用

hessian怎么发数据,怎么接数据,在springboot项目中具体的应用是什么样的?求助各位大佬

各位大神好,请问DUBBO中HTTP协议怎么配置啊

给位大神好,问题如上,我按照官方文档去配置HTTP协议,包括web.xml和dubbo.xml, 但是启动tomcat访问页面报http 500错误,错误如下: "NetworkError: 500 Internal Server Error - http://localhost:8080/dubbo_webservice/services/com.enson.webservice.service.impl.DubboServicel" 我的web.xml配置如下: ![图片说明](https://img-ask.csdn.net/upload/201512/17/1450344579_348373.png) 我的dubbo.xml配置如下: ![图片说明](https://img-ask.csdn.net/upload/201512/17/1450344600_122818.png) 请各位不吝赐教,我问了很多群,都没有解决,谢谢各位!!我也只有这么多C币,请各位不要嫌少哦。

dubbo配置路由只允许某个消费者访问

需求: 我们服务方启动后,先用某一台消费者调用服务,验证服务是否正常,然后再开放给其他消费者访问,在验证阶段,其他消费者是不能访问的。 尝试配置路由规则: 10.75.201.66是服务提供者,目标是只允许10.75.3.13这台消费者调用服务: ![图片说明](https://img-ask.csdn.net/upload/201508/14/1439545070_283613.png) 但实际上没有起作用,其他消费者还是可以调用服务。这是为什么呢? 谢谢!

spring boot 集成dubbox项目部署到tomcat下报错

2016-05-31 17:16:29 [ localhost-startStop-1:5445 ] - [ INFO ] org.springframework.cache.ehcache.EhCacheManagerFactoryBean.destroy(EhCacheManagerFactoryBean.java:181) Shutting down EhCache CacheManager 2016-05-31 17:16:29 [ localhost-startStop-1:5458 ] - [ ERROR ] org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:825) Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduledTasks': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.itanbank.admin.service.ItbCompanyService com.itanbank.admin.config.ScheduledTasks.itbCompanyService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itbCompanyServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.itanbank.admin.repository.web.ItbCompanyRepository com.itanbank.admin.service.ItbCompanyServiceImpl.itbCompanyRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itbCompanyRepository': Cannot create inner bean '(inner bean)#7623d14e' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#7623d14e': Cannot resolve reference to bean 'webEntityManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEntityManager': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.itanbank.admin.service.InvestFinishService': Cannot resolve reference to bean 'investFinishServiceImpl' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'investFinishServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.itanbank.admin.repository.web.ItbTrafficGiveRepository com.itanbank.admin.service.InvestFinishServiceImpl.itbTrafficGiveRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itbTrafficGiveRepository': Cannot create inner bean '(inner bean)#4f762393' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4f762393': Cannot resolve reference to bean 'webEntityManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEntityManager': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.itanbank.admin.service.RegisterFinishService': Cannot resolve reference to bean 'registerFinishServiceImpl' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registerFinishServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.itanbank.admin.repository.web.ItbFriendInviteRepository com.itanbank.admin.service.RegisterFinishServiceImpl.itbFriendInviteRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itbFriendInviteRepository': Cannot create inner bean '(inner bean)#403e1ecb' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#403e1ecb': Cannot resolve reference to bean 'webEntityManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEntityManager': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.itanbank.admin.service.BindBankFinishService': Cannot resolve reference to bean 'bindBankFinishServiceImpl' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bindBankFinishServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.itanbank.admin.repository.web.ItbTrafficGiveRepository com.itanbank.admin.service.BindBankFinishServiceImpl.itbTrafficGiveRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itbTrafficGiveRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Repository interface must not be null on initialization! 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$1.getObject(AbstractBeanFactory.java:306) 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:764) at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149) at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129) at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5183) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 目前问题已有解决方案,简单描述下问题:dubbo的多个接口实现类中引用了相同的业务对象dao。把dao封装成service后注入问题就没有出现了。 但是实际问题还没有解决,求大神解答。

dubbo2.7与zookeeper3.4.13如何配置ipv6

![图片说明](https://img-ask.csdn.net/upload/202004/15/1586953573_216928.png)![图片说明](https://img-ask.csdn.net/upload/202004/15/1586953657_352497.png)![图片说明](https://img-ask.csdn.net/upload/202004/15/1586953663_235160.png) dubbo版本2.7.3 zookeeper版本3.4.13 Springboot2.2 上图是启动错误。 写ipv4地址运行正常。 dubbo配置文件上写的ipv6地址。 是否有书写错误。或者配置错误。请大神指导!!

dubbo webservice 调用

**项目原来用的是cxf 的webservice接口,需要集成dubbo系统。根据配置浏览器可以访问,但是原程序中,spring mvc的注入对象为null,详细问题如下: web.xml 主要代码** <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath*:/applicationContext.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--dubbo 服务根路径--> <servlet> <servlet-name>dubbo</servlet-name> <servlet-class> com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dubbo</servlet-name> <url-pattern>/webservice/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>SearchEngine</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>SearchEngine</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <session-config> <session-timeout>30</session-timeout> </session-config> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener </listener-class> </listener> **provider.xml** <dubbo:application name="dubbo-webservice-provider" /> <!-- registry address, used for service to register itself --> <dubbo:registry address="zookeeper://127.0.0.1:2181" /> <!-- 用webservice协议在8181端口暴露服务 --> <dubbo:protocol name="webservice" port="8181" server="servlet" /> <dubbo:service interface="com.chinasofti.searchengine.webservice.server.searchService.SearchService" ref="demoWSService" /> <bean id="demoWSService" class="com.chinasofti.searchengine.webservice.server.searchService.impl.SearchServiceImpl" /> **consumer.xml** <dubbo:application name="consumer" /> <!-- registry address, used for consumer to discover services --> <dubbo:registry address="zookeeper://127.0.0.1:2181" /> <dubbo:consumer timeout="5000"/> <!-- which service to consume? --> <dubbo:reference id="demoWSService" interface="com.chinasofti.searchengine.webservice.server.searchService.SearchService" url="webservice://192.168.1.25:8181/SearchEngine/webservice/com.chinasofti.searchengine.webservice.server.searchService.SearchService"/> **通过上边的配置,可以在浏览器中访问“http://localhost:8181/SearchEngine/webservice/com.chinasofti.searchengine.webservice.server.searchService.SearchService?wsdl”,可以访问。** **在客户端访问服务主要代码:** URL url = null; try { url = new URL("http://localhost:8181/SearchEngine/webservice/com.chinasofti.searchengine.webservice.server.searchService.SearchService?wsdl"); } catch (MalformedURLException e) { } Service service = new SearchService(url); SearchServicePortType port = ((SearchService) service).getSearchServicePort(); { com.chinasofti.searchengine.webservice.client.ws.SearchModel _searchAll_arg0 = null; com.chinasofti.searchengine.webservice.client.ws.MultConditionsVO _searchAll_arg1 = null; java.lang.String _searchAll__return = port.searchAll(searchModel,vo); } **通过调试,可以调用到服务端代码,但是服务端的spring mvc @Resource标签注入的对象为null。** @Resource(name = "conClassDaoImpl") private ConClassDao conClassDao; **调试时,上边的conClassDao为null。** **项目中调用其他功能spring 标签是可以注入的,也没有问题。 我是在原有的工程中集成dubbo配置的,哪个地方可能导致调用接口是spring 标签注入失败啊?跪求各位大神,谢谢啦!**

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

为什么本科以上学历的人只占中国人口的5%,但感觉遍地都是大学生?

中国大学生占总人口不到5% 2017年,中国整体的本科率仅有5.9%;如果算上研究生,这一比例可以进一步上升到6.5% 为什么在国家统计局推出的这份年鉴中,学历的最高一阶就是到研究生,而没有进一步再统计博士生的数量的。 原因其实并不难理解,相比全国和各省整体人口体量,博士生的占比非常之低,属于绝对意义上的小概率样本。 这一点,我们从上表中的各省研究生占比情况也可以看出端倪。除北京、天津、上海三...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

6年开发经验女程序员,面试京东Java岗要求薪资28K

写在开头: 上周面试了一位女程序员,上午10::30来我们部门面试,2B哥接待了她.来看看她的简历: 个人简历 个人技能: ● 熟悉spring mvc 、spring、mybatis 等框架 ● 熟悉 redis 、rocketmq、dubbo、zookeeper、netty 、nginx、tomcat、mysql。 ● 阅读过juc 中的线程池、锁的源...

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

立即提问
相关内容推荐