dubbo:reference该怎么注入。

dubbo:reference引入的bean,该怎么注入,可以用注解@Autowired注入吗,或者@reference注入,还是只能set注入???




/dubbo:reference

1个回答

可以用Autowired

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
dubbo服务中在consumer中通过autowired方式注入bean失败

dubbo服务中生产者我已经跑起来了,但在consumer中通过autowired方式注入bean失败,网上找了很久以下三点我确定已经做了 1.在实现类上加入@Service 2.在配置文件中加入scan扫描 下面代码我只要注释掉这个UserService的Autowired就能跑起来,感觉就是这个语句的问题,但是不注入UserService就无法调用getUserAddressList,感觉没搭成功,大神帮忙看看,困扰我好久了,谢谢啊 ``` package com.atguigu.gmall.service.impl; import com.atguigu.gmall.bean.UserAddress; import com.atguigu.gmall.service.UserService; import com.atguigu.gmall.service.OrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class OrderServiceImpl implements OrderService { @Autowired UserService userService; @Override public void initOrder(String id){ //查询用户收货地址 System.out.printf(id); List<UserAddress> addressList = userService.getUserAddressList("1"); System.out.println(addressList); } } ``` 消费者配置文件如下 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> <context:component-scan base-package="com.atguigu.gmall.service.impl"></context:component-scan> <dubbo:application name="user-service-consumer"></dubbo:application> <dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry> <!-- 声明需要调用远程服务的接口 --> <dubbo:reference interface="com.atguigu.gmall.service.UserService" id="userService"></dubbo:reference> </beans> ``` 生产者配置文件如下: ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!-- 1、指定当前服务/应用的名字(同样的服务名字相同,不要和别的服务同名) --> <dubbo:application name="user-service-provider"></dubbo:application> <!-- 2、指定注册中心的位置 --> <!-- <dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry> --> <dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"></dubbo:registry> <!-- 3、指定通信规则(通信协议?通信端口) --> <dubbo:protocol name="dubbo" port="20882"></dubbo:protocol> <!-- 4、暴露服务 ref:指向服务的真正的实现对象 --> <dubbo:service interface="com.atguigu.gmall.service.UserService" ref="userServiceImpl" timeout="1000" version="1.0.0"> <dubbo:method name="getUserAddressList" timeout="1000"></dubbo:method> </dubbo:service> <!--统一设置服务提供方的规则 --> <dubbo:provider timeout="1000"></dubbo:provider> <!-- 服务的实现 --> <bean id="userServiceImpl" class="com.atguigu.gmall.service.impl.UserServiceImpl"></bean> <!-- 连接监控中心 --> <dubbo:monitor protocol="registry"></dubbo:monitor> </beans> ``` 具体报错如下 ``` F:\Java\jdk1.8.0_241\bin\java.exe "-javaagent:F:\Java\IntelliJ IDEA 2019.3.4\lib\idea_rt.jar=6493:F:\Java\IntelliJ IDEA 2019.3.4\bin" -Dfile.encoding=UTF-8 -classpath F:\Java\jdk1.8.0_241\jre\lib\charsets.jar;F:\Java\jdk1.8.0_241\jre\lib\deploy.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\access-bridge-64.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\cldrdata.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\dnsns.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\jaccess.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\localedata.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\nashorn.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\sunec.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\sunjce_provider.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\sunmscapi.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\sunpkcs11.jar;F:\Java\jdk1.8.0_241\jre\lib\ext\zipfs.jar;F:\Java\jdk1.8.0_241\jre\lib\javaws.jar;F:\Java\jdk1.8.0_241\jre\lib\jce.jar;F:\Java\jdk1.8.0_241\jre\lib\jfr.jar;F:\Java\jdk1.8.0_241\jre\lib\jfxswt.jar;F:\Java\jdk1.8.0_241\jre\lib\jsse.jar;F:\Java\jdk1.8.0_241\jre\lib\management-agent.jar;F:\Java\jdk1.8.0_241\jre\lib\plugin.jar;F:\Java\jdk1.8.0_241\jre\lib\resources.jar;F:\Java\jdk1.8.0_241\jre\lib\rt.jar;F:\Java\IdeaProjects\LearnDubbo\user-service-consumer\target\classes;F:\Java\IdeaProjects\LearnDubbo\gmall-interface\target\classes;F:\apache-maven-3.6.3\myrepo\com\alibaba\dubbo\2.6.2\dubbo-2.6.2.jar;F:\apache-maven-3.6.3\myrepo\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;F:\apache-maven-3.6.3\myrepo\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;F:\apache-maven-3.6.3\myrepo\org\apache\curator\curator-framework\2.12.0\curator-framework-2.12.0.jar;F:\apache-maven-3.6.3\myrepo\org\apache\curator\curator-client\2.12.0\curator-client-2.12.0.jar;F:\apache-maven-3.6.3\myrepo\org\apache\zookeeper\zookeeper\3.4.8\zookeeper-3.4.8.jar;F:\apache-maven-3.6.3\myrepo\log4j\log4j\1.2.16\log4j-1.2.16.jar;F:\apache-maven-3.6.3\myrepo\jline\jline\0.9.94\jline-0.9.94.jar;F:\apache-maven-3.6.3\myrepo\io\netty\netty\3.7.0.Final\netty-3.7.0.Final.jar;F:\apache-maven-3.6.3\myrepo\com\google\guava\guava\16.0.1\guava-16.0.1.jar;F:\apache-maven-3.6.3\myrepo\org\slf4j\slf4j-api\1.7.6\slf4j-api-1.7.6.jar;F:\apache-maven-3.6.3\myrepo\org\springframework\spring-context\4.3.16.RELEASE\spring-context-4.3.16.RELEASE.jar;F:\apache-maven-3.6.3\myrepo\org\springframework\spring-aop\4.3.16.RELEASE\spring-aop-4.3.16.RELEASE.jar;F:\apache-maven-3.6.3\myrepo\org\springframework\spring-beans\4.3.16.RELEASE\spring-beans-4.3.16.RELEASE.jar;F:\apache-maven-3.6.3\myrepo\org\springframework\spring-core\4.3.16.RELEASE\spring-core-4.3.16.RELEASE.jar;F:\apache-maven-3.6.3\myrepo\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;F:\apache-maven-3.6.3\myrepo\org\springframework\spring-expression\4.3.16.RELEASE\spring-expression-4.3.16.RELEASE.jar;F:\Java\IdeaProjects\LearnDubbo\user-service-provider\target\classes com.atguigu.gmall.service.MainApplication log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OrderService': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.atguigu.gmall.service.UserService. No provider available for the service com.atguigu.gmall.service.UserService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=user-service-consumer&dubbo=2.6.2&interface=com.atguigu.gmall.service.UserService&methods=getUserAddressList&pid=9012&register.ip=192.168.1.4&side=consumer&timestamp=1587052183628 to the consumer 192.168.1.4 use dubbo version 2.6.2 at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at com.atguigu.gmall.service.MainApplication.main(MainApplication.java:11) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.atguigu.gmall.service.UserService. No provider available for the service com.atguigu.gmall.service.UserService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=user-service-consumer&dubbo=2.6.2&interface=com.atguigu.gmall.service.UserService&methods=getUserAddressList&pid=9012&register.ip=192.168.1.4&side=consumer&timestamp=1587052183628 to the consumer 192.168.1.4 use dubbo version 2.6.2 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 15 more Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.atguigu.gmall.service.UserService. No provider available for the service com.atguigu.gmall.service.UserService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=user-service-consumer&dubbo=2.6.2&interface=com.atguigu.gmall.service.UserService&methods=getUserAddressList&pid=9012&register.ip=192.168.1.4&side=consumer&timestamp=1587052183628 to the consumer 192.168.1.4 use dubbo version 2.6.2 at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:66) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) ... 25 more ```

dubbo 消费者和提供者都已注册成功,但是@Reference注解注进来为null

![图片说明](https://img-ask.csdn.net/upload/201811/14/1542167689_177551.png)@Reference PublicUserLoginService publicUserLoginService; ![图片说明](https://img-ask.csdn.net/upload/201811/14/1542167718_578959.png)

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 标签注入失败啊?跪求各位大神,谢谢啦!**

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调用其他工程的服务接口 , 打上@Autowired注解启动时报下面的错 ,求大神们帮忙?

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'voucherService': Unsatisfied dependency expressed through field 'tradeOrdersService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tradeOrdersService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No such extension com.alibaba.dubbo.rpc.ProxyFactory by name tccJavassist at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~ [spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.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.otocenter.otocenterservice.OtoCenterServiceApplication.main(OtoCenterServiceApplication.java:14) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tradeOrdersService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No such extension com.alibaba.dubbo.rpc.ProxyFactory by name tccJavassist at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1647) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1216) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1462) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1202) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] ... 19 common frames omitted Caused by: java.lang.IllegalStateException: No such extension com.alibaba.dubbo.rpc.ProxyFactory by name tccJavassist at com.alibaba.dubbo.common.extension.ExtensionLoader.findException(ExtensionLoader.java:494) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.common.extension.ExtensionLoader.createExtension(ExtensionLoader.java:501) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:319) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.ProxyFactory$Adpative.getProxy(ProxyFactory$Adpative.java) ~[na:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:426) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) ~[dubbo-2.5.3.jar:2.5.3] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171) ~ [spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] ... 30 common frames omitted

急急急请教各位大神,dubbo的HessianProtocolException

调用同事的dubbo接口所有的配置都检查过没有问题,可以注入当代码走到调用注入的接口时报异常: java.lang.reflect.InvocationTargetException 接口那边的同事说请求可以过去 但是在return的时候报异常: [com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation] - [DUBBO] Decode rpc invocation failed: expected map/object at java.lang.String (Ljava/lang/String;Lorg/bigdata/framework/pay/model/WebDownResourceParam;), dubbo version: 2.8.4, current host: 10.10.184.116 com.alibaba.com.caucho.hessian.io.HessianProtocolException: expected map/object at java.lang.String (Ljava/lang/String;Lorg/bigdata/framework/pay/model/WebDownResourceParam;) at com.alibaba.com.caucho.hessian.io.AbstractDeserializer.error(AbstractDeserializer.java:108) at com.alibaba.com.caucho.hessian.io.AbstractMapDeserializer.readObject(AbstractMapDeserializer.java:70) at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1696) at com.alibaba.dubbo.common.serialize.support.hessian.Hessian2ObjectInput.readObject(Hessian2ObjectInput.java:94) at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:150) at com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:74) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:138) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:134) at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:95) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46) at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:134) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) 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) [com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec] - [DUBBO] Skip input stream 330, dubbo version: 2.8.4, current host: 10.10.184.116 [com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol] - [DUBBO] disconected from /10.20.21.130:52655,url:dubbo://10.10.184.116:9977/org.bigdata.framework.security.iservice.SecurityFacadeService?anyhost=true&application=dubbo-webservice-provider&channel.readonly.sent=true&codec=dubbo&default.delay=-1&default.retries=0&default.timeout=100000&delay=-1&dubbo=2.8.4&generic=false&heartbeat=60000&interface=org.bigdata.framework.security.iservice.SecurityFacadeService&methods=intercept,encrypt&organization=dubbox&owner=programmer&pid=28695&side=provider&timestamp=1499949941270, dubbo version: 2.8.4, current host: 10.10.184.116

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

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

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

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

哪位大神帮我看下,这是什么问题啊,说是不能注入这个类...

如题: ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.rjs.marketing.api.service.MarketingRestService': Cannot resolve reference to bean 'marketingRestService' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketingRestService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rjs.marketing.app.service.MarketingService com.rjs.marketing.app.rest.MarketingRestServiceImpl.marketingService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketingService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.rjs.marketing.app.service.task.RecommendService com.rjs.marketing.app.service.MarketingService.recommendService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'recommendService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rjs.marketing.app.vo.ServerConfig com.rjs.marketing.app.service.task.RecommendService.serverConfig; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConfig' defined in class path resource [rjs-marketing-app_context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'java.util.List' for property 'pushConfig'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map] for property 'pushConfig[0]': no matching editors or conversion strategy found ```

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后注入问题就没有出现了。 但是实际问题还没有解决,求大神解答。

springboot创建mapper有问题

``` 2018-06-29 17:05:05.775 WARN 1075 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userPhoneContactMapper' defined in file [/Users/stacktc/Documents/work/gitlab/server/partTimeJob/target/classes/com/fuming/partjob/dao/UserPhoneContactMapper.class]: Cannot resolve reference to bean 'sqlSessionFactoryBean' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactoryBean': Requested bean is currently in creation: Is there an unresolvable circular reference? ``` 日志如上,同一个项目朋友的windows就没问题,我的mac为什么报创建bean有错误, 求解。

SpringCloud 每个服务都需要有相对应的pojo吗

公司项目使用Dubbo,小弟最近学习SpringCloud,发现两者区别甚大。 Dubbo可以在一个微服务中使用@Reference注解来注入一个Service代理类,来调用执行我们定义好的接口,获取数据; SpringCloud的微服务之间是通过Http协议进行通信的,导致那么在获取数据实体的时候,在每个服务中都需要写对应的pojo类, 这个让我感觉很迷惑。**比如我有一个用户微服务,其他的微服务都需要调用这个微服务来获取用户,那么我的每个微服务都需要写上用户pojo?** 求大哥们告知一下,万分感谢

关于spring boot注解的使用@Autowired

今天写代码的时候,在一个controller里面。有一个service死活是注解不了。 放在其他的控制器或者类里面都没有问题。后来一点点测试,发现了问题。 先show代码: 控制器 ``` @CrossOrigin @RestController @RequestMapping(value = "api/kpi/TOperLog", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class TOperLogController { private Logger logger = LoggerFactory.getLogger(this.getClass()); private static final String TITLE = "OperLog"; private static final String TRUE = "true"; private static final String FALSE = "false"; @Autowired private TOperationlogService sysLogService; @AOPHandler(value = "查询") @GetMapping("/querylogbyid/{objectId}") public String querylogbyid(HttpServletRequest request, @PathVariable Integer objectId) { TOperationlogEntity obj = sysLogService.QueryOperLogById(1); return JSON.toJSONString(obj); } /** * 查询日志类型集合 * * @param request * @return */ @PostMapping("/QueryOperLogTypeList") private String QueryLogTypeList(HttpServletRequest request) { String requestURL = VerifyUtil.trimBaseHref(request.getRequestURL().toString()); try { List<String> list = sysLogService.QueryLogTypeList(); return RestfulTool.buildCollection(new ErrorInfo(TITLE, TRUE, JSON.toJSONString(list)), requestURL); } catch (Exception ex) { logger.error(String.format("内部服务器错误,修改积分计量规则失败: %s", ex.getMessage())); return RestfulTool.buildCollection(new ErrorInfo(TITLE, FALSE, "修改积分计量规则失败"), requestURL); } } /** * 获取操作日志 * @param request * @param type * @param page * @param pagesize * @return */ @PostMapping("/QueryOperLogList") private String QueryOperLogList(HttpServletRequest request,@RequestParam("type")String type,@RequestParam("page")Integer page, @RequestParam("pagesize")Integer pagesize){ String requestURL = VerifyUtil.trimBaseHref(request.getRequestURL().toString()); try { Pageable pageable=new PageRequest(page-1,pagesize); Page<TOperationlogEntity> pagelist= sysLogService.QueryOperLogList(type,pageable); return RestfulTool.buildCollection(new ErrorInfo(TITLE, TRUE, JSON.toJSONString(pagelist)), requestURL); } catch (Exception ex) { logger.error(String.format("内部服务器错误,获取操作日志失败: %s", ex.getMessage())); return RestfulTool.buildCollection(new ErrorInfo(TITLE, FALSE, "获取操作日志失败"), requestURL); } } } ``` 就是这个TOperationlogService 始终注解不了。经过排除法,是因为 @AOPHandler(value = "查询") 这个APO,去掉后正常注解。 百度后有人说如果有new的时候,就无法使用spring 来进行管理了。但是代码并没有new,下面是AOP的代码。里面也使用到了TOperationlogService,但是是通过注解方式。 ``` ** * 系统日志:切面处理类 */ @Aspect @Component public class SysLogAspect { @Autowired private TOperationlogService sysLogService; @Value("${tokenName}") private String tokenName; @Value("${tokenkey}") private String TokenKey; private Logger logger = LoggerFactory.getLogger(this.getClass()); //定义切点 @Pointcut //在注解的位置切入代码 @Pointcut(value = "@annotation(com.pcitc.sii.pfm.service.AOPHandler)") public void logPoinCut() { } /** * 控制器执行完成后,添加操作日志 * @param joinPoint */ @After("logPoinCut()") public void saveSysLog(JoinPoint joinPoint) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder .getRequestAttributes()).getRequest(); try { TOperationlogEntity oplog = new TOperationlogEntity(); //从切面织入点处通过反射机制获取织入点处的方法 MethodSignature signature = (MethodSignature) joinPoint.getSignature(); //获取切入点所在的方法 Method method = signature.getMethod(); AOPHandler myLog = method.getAnnotation(AOPHandler.class); if (myLog != null) { String value = myLog.value(); oplog.setLogDec(value);//保存获取的操作 oplog.setLogTypeCode(myLog.opertype());//操作类型 } //读取session中存储的token,从token中获取用户的信息 String tokenstr = request.getHeader(tokenName); Claims claims = JwtUtil.parseJWT(tokenstr, TokenKey); oplog.setUserName(claims.get("username").toString()); oplog.setUserId(Long.parseLong(claims.get("id").toString())); oplog.setLogDate(new Date()); sysLogService.SaveOperLog(oplog); }catch (Exception ex){ logger.error(String.format("AOP切面内部错误:{%s}",ex.getMessage()) ); } } } ``` 有人给解释下为啥会出现这个情况吗

为什么 我这个地方的mapper 文件读取不到呢spring整合mybatis

# 问题解决了 没有去除掉classpath* 顺便百度了下这两者区别 classpath和classpath*区别: classpath:只会到你的class路径中查找找文件。 classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找。 注意: 用classpath*:需要遍历所有的classpath,所以加载速度是很慢的;因此,在规划的时候,应该尽可能规划好资源文件所在的路径,尽量避免使用classpath* ```<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <context:component-scan base-package="com.itheima"> <!-- 不扫描有controller 注解的bean--> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!--加载JDBC 文件 --> <context:property-placeholder location="classpath*:jdbc.properties"/> <!-- 注入--> <!-- C3P0 --> <!--<bean id="c3p0" class="com.mchange.v2.c3p0.ComboPooledDataSource">--> <!--<property name="driverClass" value="${jdbc.driver}"/>--> <!--<property name="jdbcUrl" value="${jdbc.url}"/>--> <!--<property name="user" value="${jdbc.username}"/>--> <!--<property name="password" value="${jdbc.password}"/>--> <!--</bean>--> <!-- Druid--> <bean class="com.alibaba.druid.pool.DruidDataSource" id="druidDataSource"> <property name="driverClassName" value="${jdbc.driver}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean> <!--JDBC模板注入 --> <!--<bean class="org.springframework.jdbc.core.JdbcTemplate" id="jdbcTemplate">--> <!--<property name="dataSource" ref="c3p0" />--> <!--</bean>--> <!-- 配置核心配置文件sqlsessionconfig --> <bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory"> <property name="dataSource" ref="druidDataSource"/> <property name="configLocation" value="classpath*:sqlMapConfig.xml"/> <property name="mapperLocations" value="classpath*:common/itheima/mapper/*.xml"/> <property name="typeAliasesPackage" value="com.itheima.domian"/> </bean> <!-- 自动扫描 将Mapper接口生成代理注入到Spring --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" id="mapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <property name="basePackage" value="com.itheima.mapper"/> </bean> <!-- 数据源事务管理器 --> <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="transactionManager"> <property name="dataSource" ref="druidDataSource"/> </bean> <!-- -配置事务增强 --> <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="*"/> </tx:attributes> </tx:advice> <!-- 配置切面类 --> <aop:config> <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.itheima.service.impl.*.*(..))"></aop:advisor> </aop:config> </beans> ```这个是applicationContext.xml ```现在的问题是访问不到这个mapper下方是mybatis核心配置的文件 ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!----> <typeAliases> <typeAlias type="com.itheima.domain.User" alias="User" /> <typeAlias type="com.itheima.domian.Role" alias="Role" /> </typeAliases> <mappers> <package name="common.itheima.mapper" /> <!--<mapper resource="com/itheima/mapper/UserMapper.xml" />--> </mappers> </configuration> ``` mapper文件如下 ``` <select id="findAllUser" resultType="User"> SELECT *FROM sys_user </select> ```java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\IdeaProject\JavaEE_Code\homework\ssm-test02\target\classes\com\itheima\mapper\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [classpath*:sqlMapConfig.xml] cannot be opened because it does not exist at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) at org.springframework.beans.factory.annotation.AutowiredAnnot ``` ``` ``` ``` mapper如下 ``` public interface UserMapper { /* * 查看用户 * */ // @Select("select *from sys_user ") List<User> findAllUser(); } ```已解决 ----------------------------------------------------------------- classpath出问题了 解决成功!

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

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

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

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

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

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

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

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

讲一讲什么是Java内存模型 Java内存模型虽说是一个老生常谈的问题 ,也是大厂面试中绕不过的,甚至初级面试也会问到。但是真正要理解起来,还是相当困难,主要这个东西看不见,摸不着。 这是一个比较开放的题目,面试官主要想考察的是对Java内存模型的了解到了什么程度了,然后根据回答进行进一步的提问 下面,我们就这个问题的回答列一下我们的思路 具体的思路如下: 说一说Java内存模型的缘由 简略辨析...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

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

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

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

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

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

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

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

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

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

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

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

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

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

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

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

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

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

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

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

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

面试:第十六章:Java中级开发(16k)

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

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

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

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

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

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

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

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

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

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

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

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

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

立即提问
相关内容推荐