eclipse 使用 lombok get set方法报错

配置了 lombok 在代码中使用注解也有提示 但是get set方法一直报错
不知道怎么回事 ,求解答

2个回答

http://blog.csdn.net/echo_oy/article/details/53057809 已解决 运行后 看看eclipse安装路径下是否有 lombork.jar

eclipse.ini 里最后两行是否是
-javaagent:lombok.jar
-Xbootclasspath/a:lombok.jar
如果没有或者缺少 可以手动添加

eclipse.ini配置
有提示
get set 方法报错

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于Lombok的配置问题
用IDEA开发web项目时,已安装lombok plugin且将编辑器设置成允许使用注解,并通过@Data注解生成get和set方法,但运行时会报错,提示找不到相应的get和set方法,请问是什么原因?
安卓studio中有关lombo的问题
为什么在我的同事的studio上的工程到我的studio上就一直报错, 报错原因是因为lombok的使用,省略了get/set的书写然而在我的工具上不管用, 仍然须要重新写get/set方法,求大神指教
gradle 使用 apply plugin: "net.ltgt.apt-idea" 插件, 导致 lombok 失效, 这是什么原因?
// apply plugin: "net.ltgt.apt-idea" 把这个注释掉, 就可以正常运行, 是因为该apt导致lombok 的注解处理器无法使用吗? 有什么解决的办法, 谢谢
eclipse已经装好并配置好lombok,可是使用注解@Getter @Setter后,对象并不能调用getxx()和setxx()方法?
![图片说明](https://img-ask.csdn.net/upload/201905/12/1557651139_937739.png)![图片说明](https://img-ask.csdn.net/upload/201905/12/1557651144_820746.png)![图片说明](https://img-ask.csdn.net/upload/201905/12/1557651155_603789.png)![图片说明](https://img-ask.csdn.net/upload/201905/12/1557651165_632238.png)![图片说明](https://img-ask.csdn.net/upload/201905/12/1557651300_411206.png) ![图片说明](https://img-ask.csdn.net/upload/201905/12/1557650895_486064.png)!
lombok插件问题,求解释,有没有用过的
idea安装了lombock的,也测试过可以用的 但是用git上面下载了一个lombok的项目 就报错了, ``` Error:java: Lombok annotation handler class lombok.javac.handlers.HandleData failed on /Users/stacktc/Documents/StackTc/Github/any-video/src/main/java/cn/ictgu/service/model/mix/HubItemHubUser.java: java.lang.NoSuchFieldError: members_field ```
springcloud Hoxton.SR1 在网关中添加 zipkin 配置后报错 This converter does not support this method 应该如何解决
pom.xml 配置 ``` <dependencies> <!--微服务注册--> <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!--网关配置--> <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-zuul --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> </dependency> <!--限流--> <!-- https://mvnrepository.com/artifact/com.marcosbarbero.cloud/spring-cloud-zuul-ratelimit --> <dependency> <groupId>com.marcosbarbero.cloud</groupId> <artifactId>spring-cloud-zuul-ratelimit</artifactId> <version>2.3.0.RELEASE</version> </dependency> <!--限流redis数据库记录数据--> <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!--OAuth--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <!--自定义config配置--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.62</version> </dependency> <!-- 被zipkin服务追踪的启动依赖--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zipkin</artifactId> </dependency> <!--配置rabbitmq--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId> </dependency> </dependencies> ``` application.yml ``` server: port: 6020 spring: application: name: Gateway-Zuul #对曝光的微服务的名称 #配置redis redis: host: 127.0.0.1 port: 6379 password: admin jedis: pool: max-active: 100 max-idle: 8 min-idle: 4 max-wait: 10000 timeout: 3000 #rabbitmq rabbitmq: host: 127.0.0.1 port: 5672 username: admin password: admin #zipkin在rabbitmq消息队列zipkin zipkin: sender: type: rabbit rabbitmq: queue: zipkin #被追踪的可能性,默认是0.1 表示百分之10 sleuth: sampler: probability: 1.0 eureka: client: service-url: defaultZone: http://Eureka7001.com:7001/eureka/ registry-fetch-interval-seconds: 5 # 默认为30秒 表示eureka client间隔多久去拉取服务注册信息,默认为30秒,对于api-gateway,如果要迅速获取服务注册状态,可以缩小该值,比如5秒 instance: instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #修改之后的ip prefer-ip-address: true #访问路径显示IP地址 zuul: host: connect-timeout-millis: 15000 #HTTP连接超时要比Hystrix的大 socket-timeout-millis: 60000 #socket超时 ignored-services: "*" # 不允许用微服务名访问了,如果禁用所有的,可以使用 "*" routes: OAuth-server: /auth/** sensitive-headers: #允许传递敏感信息 #限流配置 ratelimit: enabled: true repository: REDIS behind-proxy: true add-response-headers: false default-policy-list: #optional - will apply unless specific policy exists - limit: 20 #optional - request number limit per refresh interval window quota: 1 #optional - request time limit per refresh interval window (in seconds) refresh-interval: 1 #default value (in seconds) type: #optional # - user - origin - url - httpmethod security: oauth2: client: #令牌端点 access-token-uri: http://localhost:${server.port}/auth/oauth/token #授权端点 user-authorization-uri: http://localhost:${server.port}/auth/oauth/authorize #OAuth2客户端ID client-id: test #OAuth2客户端密钥 client-secret: test authorization: check-token-access: http://localhost:${server.port}/auth/oauth/check_token resource: jwt: key-value: jkdfjkdf ribbon: ReadTimeout: 10000 ConnectTimeout: 10000 hystrix: command: default: execution: isolation: thread: timeoutInMilliseconds: 3000 circuitBreaker: enabled: true requestVolumeThreshold: 10 sleepWindowInMilliseconds: 10000 errorThresholdPercentage: 60 ``` 报错信息: ``` 2020-02-09 17:04:44.448 ERROR [Gateway-Zuul,bb484313c41a709a,0245f4527d3b0826,true] 20368 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessagingException: Failed to invoke method; nested exception is java.lang.UnsupportedOperationException: This converter does not support this method at org.springframework.integration.endpoint.MethodInvokingMessageSource.doReceive(MethodInvokingMessageSource.java:115) at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:167) at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:250) at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:359) at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:328) at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$null$1(AbstractPollingEndpoint.java:275) at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55) at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$2(AbstractPollingEndpoint.java:272) at org.springframework.cloud.sleuth.instrument.async.TraceRunnable.run(TraceRunnable.java:67) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.UnsupportedOperationException: This converter does not support this method at org.springframework.integration.support.converter.DefaultDatatypeChannelMessageConverter.toMessage(DefaultDatatypeChannelMessageConverter.java:85) at org.springframework.messaging.converter.CompositeMessageConverter.toMessage(CompositeMessageConverter.java:83) at org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry$FunctionInvocationWrapper.lambda$convertOutputValueIfNecessary$2(BeanFactoryAwareFunctionRegistry.java:620) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry$FunctionInvocationWrapper.convertOutputValueIfNecessary(BeanFactoryAwareFunctionRegistry.java:626) at org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry$FunctionInvocationWrapper.doApply(BeanFactoryAwareFunctionRegistry.java:569) at org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry$FunctionInvocationWrapper.get(BeanFactoryAwareFunctionRegistry.java:474) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:266) at org.springframework.integration.endpoint.MethodInvokingMessageSource.doReceive(MethodInvokingMessageSource.java:112) ... 19 moreyi ```
求助sprinboot整合 elasticsearch-rest-high-level-client-5.6.4报错
以下是报错信息: Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientConfigurations$RestHighLevelClientConfiguration.elasticsearchRestHighLevelClient(RestClientConfigurations.java:75) The following method did not exist: org.elasticsearch.client.RestHighLevelClient.<init>(Lorg/elasticsearch/client/RestClientBuilder;)V The method's class, org.elasticsearch.client.RestHighLevelClient, is available from the following locations: jar:file:/Users/jianxiaowen/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.4/elasticsearch-rest-high-level-client-5.6.4.jar!/org/elasticsearch/client/RestHighLevelClient.class It was loaded from the following location: file:/Users/jianxiaowen/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.4/elasticsearch-rest-high-level-client-5.6.4.jar Action: Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RestHighLevelClient 以下是pom文件,是springboot版本和这个es不兼容吗,原来用的es6.x是可以的,换成5.x就不行了,但是公司环境就要求5.x: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.xxx</groupId> <artifactId>repservice</artifactId> <version>1.0</version> <modules> <module>kg-business</module> </modules> <packaging>pom</packaging> <name>repservice</name> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <elasticsearch.version>5.6.4</elasticsearch.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.x x x.datanlp</groupId> <artifactId>graph-db-sdk</artifactId> <version>1.1-SNAPSHOT</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.13</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-commons</artifactId> <version>2.1.10.RELEASE</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.restdocs</groupId> <artifactId>spring-restdocs-mockmvc</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter-test</artifactId> <version>2.1.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> <version>5.2.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.3</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.12</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.10</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>4.5.10</version> </dependency> <dependency> <groupId>io.reactivex.rxjava2</groupId> <artifactId>rxjava</artifactId> <version>2.2.9</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.6</version> </dependency> <!-- 引入 redis 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.solr/solr-solrj --> <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> <version>8.2.0</version> </dependency> <!-- 解压rar --> <dependency> <groupId>com.github.junrar</groupId> <artifactId>junrar</artifactId> <version>4.0.0</version> </dependency> <!-- 解压zip --> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> <version>1.10.7</version> </dependency> <!--结果验证--> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <version>2.4.0</version> </dependency> <!-- 临时--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.51</version> </dependency> <dependency> <groupId>com.arangodb</groupId> <artifactId>arangodb-java-driver</artifactId> <version>5.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-web --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-web</artifactId> <version>2.7</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>5.6.4</version> </dependency> <!-- Java Low Level REST Client --> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>5.6.4</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>5.6.4</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> ```
ElasticSearch 6.3.2版本整合springBoot 报错 java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)
在服务器上搭建了一个单机的ElasticSearch 版本6.3.2,因为本地访问服务器的9200端口访问不到(network.host:0.0.0.0启动报错),所以用nginx做了代理9002端口对应9200,9001端口对应9300,直接访问访问成功如下:![图片说明](https://img-ask.csdn.net/upload/202002/08/1581096007_348190.jpg)![图片说明](https://img-ask.csdn.net/upload/202002/08/1581096016_248026.png) 然后我用写了个Demo但是一直报错 java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50); 配置文件如下: ![图片说明](https://img-ask.csdn.net/upload/202002/08/1581096398_340973.jpg) ![图片说明](https://img-ask.csdn.net/upload/202002/08/1581096609_898535.jpg) 错误日志和pom.xml文件如下: ``` exception caught on transport layer [NettyTcpChannel{localAddress=/192.168.1.103:61678, remoteAddress=/xxx.xxx.xxx.xxx:9001}], closing connection io.netty.handler.codec.DecoderException: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:472) ~[netty-codec-4.1.31.Final.jar:4.1.31.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278) ~[netty-codec-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241) [netty-handler-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:548) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:502) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) [netty-transport-4.1.31.Final.jar:4.1.31.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) [netty-common-4.1.31.Final.jar:4.1.31.Final] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191] Caused by: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50) at org.elasticsearch.transport.TcpTransport.validateMessageHeader(TcpTransport.java:1315) ~[elasticsearch-6.3.2.jar:6.4.3] at org.elasticsearch.transport.netty4.Netty4SizeHeaderFrameDecoder.decode(Netty4SizeHeaderFrameDecoder.java:36) ~[transport-netty4-client-6.4.3.jar:6.4.3] at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502) ~[netty-codec-4.1.31.Final.jar:4.1.31.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441) ~[netty-codec-4.1.31.Final.jar:4.1.31.Final] ... 19 common frames omitted ``` pom.xml文件如下 ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com</groupId> <artifactId>elasticsearchtest</artifactId> <version>0.0.1-SNAPSHOT</version> <name>elasticsearchtest</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>6.3.2</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>6.3.2</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>6.3.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.10</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` 请大神帮忙看看,谢谢啦!
lombok和swagger的冲突
# 在实体类上使用@Data注释会导致Swagger的@ApiResponse内容显示不出来 # ## 实体类说明 ![图片说明](https://img-ask.csdn.net/upload/201910/28/1572254883_117534.png) ## swagger ![图片说明](https://img-ask.csdn.net/upload/201910/28/1572254941_672128.png) ## 显示结果 ![图片说明](https://img-ask.csdn.net/upload/201910/28/1572254490_627125.png) 但是如果将@Data注解去掉改成getter()和setter(),数据又能够出来了
vue前端websocket连接不上springboot,报错Connection closed before receiving a handshake response
搞定了,我的代码写的基本没有问题,毕竟都是按着教程一步一步来的,主要问题在于,我的开发环境和教程不一致,我是前后端分离,请求8080即请求的前端项目,当然会超时然后建立连接失败。我查看了一下前后端各自的端口:前端8080,后端63000,然后把 ``` this.sock = new WebSocket("ws:localhost:8080/websocket");//建立连接 ``` 改成 ``` this.sock = new WebSocket("ws:localhost:63000/websocket");//建立连接 ``` 就可以了,换成后端的端口号。 --- 以下是原问题 --- 照着网上的教程写的例子,整合到自己的项目中。前端用vue写的,js里几乎和教程一模一样,主要问题在于 ``` this.sock = new WebSocket("ws:localhost:8080/websocket");//建立连接 ``` --- **创建的websocket内的方法都是null,如图:** ![图片说明](https://img-ask.csdn.net/upload/201909/24/1569293600_266157.png) --- **然后观察控制台内过了一段时间报错,提示:** ``` WebSocket connection to 'ws://localhost:8080/websocket' failed: Connection closed before receiving a handshake response ``` --- **控制台错误详情见图:** ![图片说明](https://img-ask.csdn.net/upload/201909/24/1569294057_247788.png) --- **前端代码:** ``` webSocket() { debugger; // 建立socket连接 if ('WebSocket' in window) {//判断当前浏览器是否支持webSocket // this.sock = new WebSocket("ws:localhost:8080/bootTest/websocket");//建立连接(带后端项目名) this.sock = new WebSocket("ws:localhost:8080/websocket");//建立连接(不带后端项目名) } else { alert('你的浏览器暂不支持websocket :('); } var sock = this.sock; console.log(sock); sock.onopen = function (e) {//成功建立连接 console.log(e); }; sock.onmessage = function (e) {//接收到消息 console.log(e) $(".message").append("<p><font color='red'>"+e.data+"</font>") }; sock.onerror = function (e) {//连接发生错误 console.log(e); }; sock.onclose = function (e) {//连接关闭 console.log(e); }; ////监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。 window.onbeforeunload = function(){ websocket.close(); }; } ``` --- --- --- --- 后端代码: ``` import java.io.IOException; import java.util.concurrent.CopyOnWriteArraySet; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; import javax.websocket.*; import lombok.extern.slf4j.Slf4j; @Slf4j @ServerEndpoint("/websocket") public class WebSocketServer { //静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。 private static int onlineCount = 0; //concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<WebSocketServer>(); //与某个客户端的连接会话,需要通过它来给客户端发送数据 private Session session; /** * 连接建立成功调用的方法*/ @OnOpen public void onOpen(Session session) { this.session = session; webSocketSet.add(this); //加入set中 addOnlineCount(); //在线数加1 log.info("有新连接加入!当前在线人数为" + getOnlineCount()); try { sendMessage("连接成功"); } catch (IOException e) { log.error("websocket IO异常"); } } // //连接打开时执行 // @OnOpen // public void onOpen(@PathParam("user") String user, Session session) { // currentUser = user; // System.out.println("Connected ... " + session.getId()); // } /** * 连接关闭调用的方法 */ @OnClose public void onClose() { webSocketSet.remove(this); //从set中删除 subOnlineCount(); //在线数减1 log.info("有一连接关闭!当前在线人数为" + getOnlineCount()); } /** * 收到客户端消息后调用的方法 * @param message 客户端发送过来的消息 */ @OnMessage public void onMessage(String message, Session session) { log.info("来自客户端的消息:" + message); //群发消息 for (WebSocketServer item : webSocketSet) { try { item.sendMessage(message); } catch (IOException e) { e.printStackTrace(); } } } /** * 发生错误 * @param session * @param error */ @OnError public void onError(Session session, Throwable error) { log.error("发生错误"); error.printStackTrace(); } public void sendMessage(String message) throws IOException { this.session.getBasicRemote().sendText(message); } /** * 群发自定义消息 * */ public static void sendInfo(String message) throws IOException { log.info(message); for (WebSocketServer item : webSocketSet) { try { item.sendMessage(message); } catch (IOException e) { continue; } } } public static synchronized int getOnlineCount() { return onlineCount; } public static synchronized void addOnlineCount() { WebSocketServer.onlineCount++; } public static synchronized void subOnlineCount() { WebSocketServer.onlineCount--; } } ```
ant打包lombok一直编译失败,求大神指点
ant打包的时候我的build.xml文件如下,只要是涉及到lombok中的内容都编译不上,例如@Slf4j的log或者lombok中的val类型,还有那些注解编译都是失败的,求大神指点 <?xml version="1.0" encoding="UTF-8"?> <!-- 定义一个工程,默认任务为warFile。 --> <project name="hera_insure_v2" default="warFile" basedir="."> <!-- 定义属性,打成war包的名称。 --> <property name="warFileName" value="hera_insure_v2.war"/> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <property name="ant.dir" value="D:/software/apache-ant-1.10.1/lib"/> <!-- 定义路径,编译java文件时用到的jar包。 --> <path id="project.lib"> <fileset dir="${basedir}/WebContent/WEB-INF/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${ant.dir}"> <include name="**/*.jar"/> </fileset> </path> <!-- 定义任务,清空任务:清空原有的class文件,创建新的build路径。 --> <target name="clean"> <delete dir="${basedir}/build" /> <mkdir dir="${basedir}/build" /> </target> <!--看官网这么写,自己改的--> <!-- <target name="javadoc" depends="clean"> <taskdef classname="lombok.delombok.ant.Tasks$Delombok" classpath="${basedir}/WebContent/WEB-INF/lib/lombok-1.16.6.jar" name="delombok" /> <mkdir dir="build/src-delomboked" /> <delombok verbose="true" encoding="UTF-8" to="${basedir}/build" from="${basedir}/src"> <format value="suppressWarnings:skip" /> </delombok> <javadoc sourcepath="${basedir}/src" defaultexcludes="yes" destdir="${basedir}/build" /> </target> --> <!-- 定义任务,编译src文件夹中的java文件,编译后的class文件放到创建的文件夹下。 --> <target name="compile" depends="clean"> <!--之前普通编译成功的--> <!-- <javac srcdir="${basedir}/src" destdir="${basedir}/build" includeantruntime="false" source="1.7" target="1.7"> <compilerarg line="-encoding UTF-8"/> <classpath refid="project.lib" /> </javac> --> <!--jdt编译--> <javac classpathref="project.lib" srcdir="${basedir}/src" destdir="${basedir}/build" compiler="org.eclipse.jdt.core.JDTCompilerAdapter" nowarn="false" debug="true" debuglevel="source,lines,vars" source="1.7" target="1.7" encoding="utf-8" fork="true" memoryMaximumSize="512m" includeantruntime="false"/> </target> <!--复制xml文件--> <target name="copy-xml-files" depends="compile"> <copy todir="${basedir}/build/cn/tk/hera/insure/core/"> <fileset dir="${basedir}/src/cn/tk/hera/insure/core/"/> </copy> </target> <!--复制配置文件--> <target name="copy-config-files" depends="copy-xml-files"> <copy todir="${basedir}/build/"> <fileset dir="${basedir}/resource/"/> </copy> </target> <!-- 定义默认任务,将class文件集合成jar包。 --> <target name="warFile" depends="copy-config-files"> <!-- 删除原有war包。 --> <delete dir="${basedir}/${warFileName}" /> <!-- 建立新war包。 --> <war destfile="${basedir}/${warFileName}" webxml="${basedir}/WebContent/WEB-INF/web.xml"> <!-- 将非jar和非class文件拷贝到war包的对应路径下。 --> <fileset dir="${basedir}/WebContent"> <include name="**/**.*" /> <exclude name="**/*.jar"/> <exclude name="**/*.class"/> </fileset> <!-- 将jar和class文件拷贝到war包的对应路径下。 --> <lib dir="${basedir}/WebContent/WEB-INF/lib" /> <classes dir="${basedir}/build"/> </war> </target> </project>
对Lombok有点好奇。有人解释下原理么
使用Lombok的都知道 ,在属性前加入注解@Setter or @Getter后,在eclipse下就能够立马看到getter方法和setter方法 <br />,Lombok采用 Annotation Processor实现增强setter和getter。可是问题是:他在注解后怎么就能立马写进去呢?是跟eclipse即时编译的事件有关?还是其他的呢?小弟没想明白 <br /> <br /><span style="font-size: medium"><span style="color: red">小弟开始以为是字节码增强。所以对各位表示歉意 </span></span><br/><strong>问题补充</strong><br/>无人问津啊。。。<br/><strong>问题补充</strong><br/>求抛哥。。。求各位大牛<br/><strong>问题补充</strong><br/>又沉了啊 。。大家都不屑嘛 还是???<br/><strong>问题补充</strong><br/><div class="quote_title">RednaxelaFX 写道</div><div class="quote_div">Lombok不是通过字节码改写来实现的。 <br />它主要是用编译器内支持的annotation processing,直接操纵抽象语法树(AST),根据需要添加新节点。 <br />以javac为例的话,请参考官方文档:<a href="http://openjdk.java.net/groups/compiler/doc/compilation-overview/index.html" target="_blank">http://openjdk.java.net/groups/compiler/doc/compilation-overview/index.html</a></div> <br />哦哦 谢谢了,我还以为是字节码增强的方式实现的呢。呵呵谢谢哈。 <br /> <br />估计别人看到我的问题中就是错的 ,所以不屑回答嘛 呵呵<br/><strong>问题补充</strong><br/><div class="quote_title">skzr.org 写道</div><div class="quote_div">你的用户名很牛b。 <br /> <br />我不会,所以不回答。</div> <br />谢谢你,呵呵 你关注了 所以也算帮助了我
gateway启动报错 应该是依赖冲突的问题 求解
gateway启动报错 No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} spring-boot-starter-web和gateway冲突已经去掉了 父pom也检查过了还是不行。 下面是pom文件 gateway的pom ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.zc</groupId> <artifactId>ZC-Z-Server-Gateway</artifactId> <version>1.0.0</version> <name>ZC-Z-Server-Gateway</name> <description>网关服务</description> <properties> <java.version>1.8</java.version> <spring.security.oauth2.autoconfigure>2.1.3.RELEASE</spring.security.oauth2.autoconfigure> <spring-cloud.version>Greenwich.SR1</spring-cloud.version> <!--<alibaba.fastjson>1.2.56</alibaba.fastjson>--> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.zc</groupId> <artifactId>ZC-Common</artifactId> <version>1.0.0</version> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </exclusion> <exclusion> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` common的pom ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.zc</groupId> <artifactId>ZC-Common</artifactId> <version>1.0.0</version> <name>ZC-Common</name> <description>公共应用模块</description> <packaging>jar</packaging> <properties> <java.version>1.8</java.version> <mybatis.plus.boot>3.0.7.1</mybatis.plus.boot> <alibaba.fastjson>1.2.56</alibaba.fastjson> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring.security.oauth2.autoconfigure>2.1.3.RELEASE</spring.security.oauth2.autoconfigure> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.1.3.RELEASE</version> </dependency> <dependency> <groupId>com.zc</groupId> <artifactId>ZC-Entity</artifactId> <version>1.0.0</version> <exclusions> <exclusion> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!--<dependency>--> <!--<groupId>org.springframework.boot</groupId>--> <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis.plus.boot}</version> </dependency> <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${alibaba.fastjson}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt --> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.security.oauth.boot/spring-security-oauth2-autoconfigure --> <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>${spring.security.oauth2.autoconfigure}</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> </dependencies> <!--统一插件配置版本管理 TODO--> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <!--指定编译时的jdk版本--> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> </build> </project> ``` entity的pom ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.zc</groupId> <artifactId>ZC-Entity</artifactId> <version>1.0.0</version> <name>ZC-Entity</name> <description>实体类</description> <packaging>jar</packaging> <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <dependencies> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>3.0.7.1</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.validation/validation-api --> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>2.0.1.Final</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.1.23</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.9.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency> </dependencies> <!--统一插件配置版本管理 TODO--> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <!--指定编译时的jdk版本--> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> </build> </project> ```
ConfigurationProperties与 lombok的注解 编译时 栈溢出
在执行 ```./gradlew assemble```时 ,出现了```java.lang.StackOverflowError```的异常。启用 ```--stacktrace```参数,发现异常栈中的方法循环调用位于这个类中```org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor```。该类用于处理```ConfigurationProperties```注解。 如下的这个类同时打上了`@ConfigurationProperties` 和 `@Data`,移除其一 后就可以顺利编译。 是什么原因造成的呢? ```java @ConfigurationProperties(prefix = "config") @Data public class DeployGroupConfig { int a; } ``` **异常栈信息如下** ``` > java.lang.StackOverflowError * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileJava'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101) at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46) at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) Caused by: java.lang.RuntimeException: java.lang.StackOverflowError at com.sun.tools.javac.main.Main.compile(Main.java:553) at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:89) at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:50) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:36) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:100) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38) at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:49) at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:35) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:39) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:110) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:106) at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:59) at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:43) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:153) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:121) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99) ... 31 more Caused by: java.lang.StackOverflowError at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4652) at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3846) at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3838) at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4652) at com.sun.tools.javac.code.Types$26.visitWildcardType(Types.java:3871) at com.sun.tools.javac.code.Types$26.visitWildcardType(Types.java:3838) at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:623) at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4652) at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3851) at com.sun.tools.javac.code.Types$26.visitClassType(Types.java:3838) at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4652) at com.sun.tools.javac.code.Types.hashCode(Types.java:3835) at com.sun.tools.javac.code.Types$TypePair.hashCode(Types.java:3520) at com.sun.tools.javac.code.Types$4.containsTypeRecursive(Types.java:875) at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:927) at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:844) at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571) at com.sun.tools.javac.code.Types.isSubtype(Types.java:840) at com.sun.tools.javac.code.Types.isSubtype(Types.java:804) at com.sun.tools.javac.code.Types.isSubtypeUncheckedInternal(Types.java:757) at com.sun.tools.javac.code.Types.isSubtypeUnchecked(Types.java:741) at com.sun.tools.javac.code.Types.isConvertible(Types.java:299) at com.sun.tools.javac.code.Types.isAssignable(Types.java:2164) at com.sun.tools.javac.code.Types.isAssignable(Types.java:2125) at com.sun.tools.javac.model.JavacTypes.isAssignable(JavacTypes.java:104) at org.springframework.boot.configurationprocessor.TypeUtils.isCollectionOrMap(TypeUtils.java:134) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processSimpleTypes$0(ConfigurationMetadataAnnotationProcessor.java:274) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processSimpleTypes(ConfigurationMetadataAnnotationProcessor.java:267) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:259) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedLombokTypes(ConfigurationMetadataAnnotationProcessor.java:336) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:262) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:390) at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processNestedLombokTypes$3(ConfigurationMetadataAnnotationProcessor.java:339) 很长,省略.... ```
SSM 项目部署到 阿里云 linux 服务器上 运行jar包就报错 maxActive can't not set zero
![图片说明](https://img-ask.csdn.net/upload/201907/26/1564100265_687777.jpg)![图片说明](https://img-ask.csdn.net/upload/201907/26/1564100427_344362.jpg) ![图片说明](https://img-ask.csdn.net/upload/201907/26/1564100545_57510.jpg) 配置文件 .yml ``` spring: http: multipart: enabled: false mvc: static-path-pattern: /static/** resources: static-locations: classpath:/static thymeleaf: prefix: classpath:/templates/ suffix: .html cache: false check-template: true check-template-location: true enabled: true encoding: UTF-8 mode: HTML devtools: restart: enabled: true #设置开启热部署 datasource: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC username: root password: root # 初始化大小,最大,最小 initial-size: 1 max-active: 20 min-idle: 1 # 配置获取连接等待超时的时间 max-wait: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 time-between-eviction-runs-millis: 60000 # 配置一个连接在池中最小生存的时间,单位是毫秒 min-evictable-idle-time-millis: 300000 validation-query: select 'x' test-while-idle: true test-on-borrow: false test-on-return: false # 打开PSCache,并且指定每个连接上PSCache的大小 pool-prepared-statements: true max-open-prepared-statements: 20 filters: stat,wall,slf4j jpa: show-sql: true database: mysql hibernate: ddl-auto: update properties: hibernate: format_sql: true server: port: 8080 ## 该配置节点为独立的节点,若将这个配置放在spring的节点下,会导致配置无法被识别 mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: org.dream.www.eims.pojo ``` pom ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>org.dream.www</groupId> <artifactId>eims</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>eims</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--Thymeleaf--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!--aop--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <!--mybatis--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!--热部署--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <!--JPA--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!--德鲁伊--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.10</version> </dependency> <!--省去get set--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!--aop--> <dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.21</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.41</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!--该配置必须--> <fork>true</fork> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build> </project> ```
springboot启动报错org.apache.tomcat.util.net.NioEndpoint
springboot启动后就一直报这个,不影响访问,但是总觉得哪里不对,,,,,我使用的nohup java -jar -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms2048m -Xmx2048m -Xmn768m -Xss256k -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=15 jiyaoNewWeb-1.0.jar >springboot.log 2>&1 & 这个命令来启动的,我使用nohup java -jar xxx&命令来启动也是这样,这个怎么解决啊?? 2019-08-26 22:42:54,609 [https-jsse-nio-443-exec-1] ERROR org.apache.tomcat.util.net.NioEndpoint - java.lang.IllegalArgumentException: null at java.nio.Buffer.position(Buffer.java:244) at org.apache.tomcat.util.net.TLSClientHelloExtractor.skipBytes(TLSClientHelloExtractor.java:221) at org.apache.tomcat.util.net.TLSClientHelloExtractor.<init>(TLSClientHelloExtractor.java:118) at org.apache.tomcat.util.net.SecureNioChannel.processSNI(SecureNioChannel.java:276) at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:174) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1436) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) 这是我的pom==> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.boot</groupId> <artifactId>jiyaoNewWeb</artifactId> <version>1.0</version> <packaging>jar</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> <relativePath/> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> <dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-java-sdk-core</artifactId> <version>4.0.3</version> </dependency> <dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-java-sdk-dysmsapi</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.20</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>23.0</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.10-FINAL</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore --> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.10</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.6</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- mybatis整合 --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.1</version> </dependency> <!-- 引入thymelaf 则不需要引入web依赖,若不需要thymelaf则需要添加spring-boot-starter-web --> <!--<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>--> <!-- mysql驱动 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- 连接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.12</version> </dependency> <!--<dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version> </dependency>--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> </dependency> <!--<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>5.1.2.RELEASE</version> </dependency>--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.54</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>1.5.13.RELEASE</version> </dependency> <dependency> <groupId>com.taobao</groupId> <artifactId>taobao-sdk-java-auto_1554188611497</artifactId> <version>20190513</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.2</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.boot.SpringWebApplication</mainClass> <classpathPrefix>lib/</classpathPrefix> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>
spring boot mybatis 枚举错误,无法映射
spring boot mybatis 枚举错误 * 今天遇到一个问题,解决了好几个小时,没有搞定,搞到现在,有大佬可以帮我看下吗?万分感谢,没有分了,枚举映射,在idea中可以使用, 部署使用java -jar 方式就报错 * jdk1.8 * mybatis3.0.7.1 * application.yml环境为prod * ``` mybatis-plus: #枚举 typeHandlersPackage: com.xxx.common.module.handler ``` * 查询代码,不能转换 * ``` public LsAppEntity queryByAppKey(String appKey) { return this.getOne(new QueryWrapper<LsAppEntity>() .eq("app_key", appKey) .ne("status", StatusEnum.删除)); } ``` 1. Enum代码 ``` /** * Enum - 状态 * * @author xxx * @version 1.0.0 */ @JSONType(serializeEnumAsJavaBean = true) @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum StatusEnum implements BaseEnum<StatusEnum, Integer> { /** 删除 */ 删除(-1, "删除"), /** 无效 */ 无效(0, "无效"), /** 有效 */ 有效(1, "有效"); /** * 值. */ private Integer value; /** * 名称. */ private String name ; static { subClass.add(StatusEnum.class); } StatusEnum(Integer value, String name) { this.value = value; this.name = name; } @Override public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } //根据key获取枚举 public static StatusEnum getEnumByValue(Integer value){ if (null == value){ return null; } for(StatusEnum e: StatusEnum.values()){ if(e.getValue().equals(value)){ return e; } } return null; } } ``` 2. 枚举转换处理器 ``` package com.xxx.common.module.handler; import com.xxx.common.module.enums.*; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedTypes; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * 枚举转换处理器 * * @author xxx * @version 1.0.0 */ @Slf4j @MappedTypes(value = {StatusEnum.class}) public final class BaseEnumTypeHandler<E extends BaseEnum> extends BaseTypeHandler<E> { private Class<E> type; private E[] enums; public BaseEnumTypeHandler() { } public BaseEnumTypeHandler(Class<E> type) { if (type == null) { throw new IllegalArgumentException("Type argument cannot be null"); } this.type = type; this.enums = this.type.getEnumConstants(); if (this.enums == null) { throw new IllegalArgumentException(type.getSimpleName() + " does not represent an enum type."); } } @Override public void setNonNullParameter(PreparedStatement ps, int i, E parameter, JdbcType jdbcType) throws SQLException { //BaseTypeHandler 进行非空校验 log.debug("index : {}, parameter : {},jdbcType : {} ", i, parameter.getValue(), jdbcType); if (jdbcType == null) { ps.setObject(i, parameter.getValue()); } else { ps.setObject(i, parameter.getValue(), jdbcType.TYPE_CODE); } } @Override public E getNullableResult(ResultSet rs, String columnName) throws SQLException { Object code = rs.getObject(columnName); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(ResultSet rs, int columnIndex) throws SQLException { Object code = rs.getObject(columnIndex); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { Object code = cs.getObject(columnIndex); if (cs.wasNull()) { return null; } return getEnmByCode(code); } private E getEnmByCode(Object code) { if (code == null) { throw new NullPointerException("the result code is null " + code); } if (code instanceof Integer) { for (E e : enums) { if (e.getValue() == code) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } if (code instanceof String) { for (E e : enums) { if (code.equals(e.getValue())) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } } ``` 3. 报错信息 2020-01-20 02:45:35.879 ERROR 2472 --- [nio-8081-exec-1] c.l.exception.RRExceptionHandler : nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) * at com.sun.proxy.$Proxy132.selectList(Unknown Source) * at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.executeForMany(PageMapperMethod.java:173) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.execute(PageMapperMethod.java:86) * at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:64) * at com.sun.proxy.$Proxy137.selectList(Unknown Source) * at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getOne(ServiceImpl.java:259) * at com.baomidou.mybatisplus.extension.service.IService.getOne(IService.java:230) * at com.xxx.common.module.service.impl.AppServiceImpl.queryByAppKey(AppServiceImpl.java:100) * at com.xxx.common.module.service.impl.AppServiceImpl$$FastClassBySpringCGLIB$$9380a940.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppServiceImpl$$EnhancerBySpringCGLIB$$307b01.queryByAppKey(<generated>) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.validateBaseApi(AppInfoServiceImpl.java:141) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.appInfo(AppInfoServiceImpl.java:157) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$FastClassBySpringCGLIB$$2bb67632.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$EnhancerBySpringCGLIB$$8bd88917.appInfo(<generated>) * at com.xxx.controller.ApiAppProductController.list(ApiAppProductController.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) * at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) * at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) * at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) * at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) * at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) * at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) * at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) * at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at com.xxx.common.xss.XssFilter.doFilter(XssFilter.java:24) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) * at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) * at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) * at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) * at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) * at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) * at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) * at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) * at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) * at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) * at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) * at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) * at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) * at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) * at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) * at java.lang.Thread.run(Thread.java:745) * Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:68) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:520) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:401) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:355) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:330) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:303) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:196) * at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) * at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) * at com.sun.proxy.$Proxy200.query(Unknown Source) * at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) * at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) * ... 77 common frames omitted * Caused by: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at java.lang.Enum.valueOf(Enum.java:238) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:49) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:26) * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:66) * ... 102 common frames omitted
spring boot生成gradle工程,lombok依赖注入有问题,怎么解决?
## 1 生成gradle工程时选择lombok ## 2 build.gradle代码如下 ![图片说明](https://img-ask.csdn.net/upload/201906/08/1559982303_248676.png) ## 3 lombok.Data类引入不了 ![图片说明](https://img-ask.csdn.net/upload/201906/08/1559983498_210020.png)
springboot整合mybatis-plus无法映射xml文件
异常信息: ```org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)``` 异常原因排除: 1. 项目正常启动 2. mybaits-plus配置mapper.xml扫描没问题 ```xml mybatis-plus: # 配置扫描xml mapper-locations: classpath*:mapper/*/*Mapper.xml # 实体扫描,多个package用逗号或者分号分隔 type-aliases-package: org.cnplo.control.modules.admin.domain ``` 3. mapperscan扫描mapper正常 4.mybatis-plus的配置文件 MybatisPlusConfig配置 ```java @Configuration @MapperScan("org.cnplo.control.modules.*.mapper") public class MybatisPlusConfig { /** * 乐观锁插件 */ @Bean public OptimisticLockerInterceptor optimisticLockerInterceptor() { return new OptimisticLockerInterceptor(); } /** * mybatis-plus分页插件 */ @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } } ``` DruidDataSourceConfig配置 ```java @Configuration public class DruidDataSourceConfig { /** * @return DruidDataSource */ @Bean @ConfigurationProperties(prefix = "spring.datasource") public DruidDataSource druidDataSource() { return new DruidDataSource(); } /** * 配置事物管理器 */ @Bean public DataSourceTransactionManager transactionManager() { return new DataSourceTransactionManager(druidDataSource()); } } ``` 项目正常启动,执行数据库请求的时候异常BindingException。请问这是什么问题,大胆猜测是哪个jar包升级引起的,还请大佬们不吝赐教 ``` <properties> <java.version>1.8</java.version> <json.version>1.2.54</json.version> <druid.version>1.1.20</druid.version> <swagger.version>2.7.0</swagger.version> <mybatisplus.version>3.3.1.tmp</mybatisplus.version> </properties> <dependencies> <!--web--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--lombok--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!--druid--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- mybatisplus与springboot整合 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatisplus.version}</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>${mybatisplus.version}</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-autoconfigure</artifactId> <version>1.3.2</version> </dependency> <!-- swagger2 rest api start--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.version}</version> </dependency> <!--json工具--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${json.version}</version> </dependency> <!-- jwt --> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> <!--redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!--thymeleaf--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!--test--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies> ```
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
ES6基础-ES6的扩展
进行对字符串扩展,正则扩展,数值扩展,函数扩展,对象扩展,数组扩展。 开发环境准备: 编辑器(VS Code, Atom,Sublime)或者IDE(Webstorm) 浏览器最新的Chrome 字符串的扩展: 模板字符串,部分新的方法,新的unicode表示和遍历方法: 部分新的字符串方法 padStart,padEnd,repeat,startsWith,endsWith,includes 字
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
web前端javascript+jquery知识点总结
Javascript javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ,语法同java类似,是一种解释性语言,边执行边解释。 JavaScript的组成: ECMAScipt 用于描述: 语法,变量和数据类型,运算符,逻辑控制语句,关键字保留字,对象。 浏览器对象模型(Br
Qt实践录:开篇
本系列文章介绍笔者的Qt实践之路。 背景 笔者首次接触 Qt 大约是十多年前,当时试用了 Qt ,觉得不如 MFC 好用。现在 Qt 的 API、文档等都比较完善,在年初决定重新拾起,正所谓技多不压身,将 Qt 当为一种谋生工具亦未尝不可。利用春节假期的集中时间,快速专攻一下。 本系列名为“Qt实践”,故不是教程,笔者对 Qt 的定位是“使用”,可以帮助快速编写日常的工具,如串口、网络等。所以不
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
一条链接即可让黑客跟踪你的位置! | Seeker工具使用
搬运自:冰崖的部落阁(icecliffsnet) 严正声明:本文仅限于技术讨论,严禁用于其他用途。 请遵守相对应法律规则,禁止用作违法途径,出事后果自负! 上次写的防社工文章里边提到的gps定位信息(如何防止自己被社工或人肉) 除了主动收集他人位置信息以外,我们还可以进行被动收集 (没有技术含量) Seeker作为一款高精度地理位置跟踪工具,同时也是社交工程学(社会工程学)爱好者...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧...... 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c#判断数字不得为负数 c#帧和帧协议 c#算偏移值 c# 在枚举中 c#6 字符串 插值 c#程序中的占位符标签 c#监听数组变化 c# vlc c#索引实现 c# 局域网广播通信
立即提问