找不到@Getter和@Setter [英] Can not find @Getter and @Setter

查看:934
本文介绍了找不到@Getter和@Setter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用OAuth添加用户和身份验证.我紧接着跟随教程:视频 这是他的源代码: https://github.com/arocketman/Spring-oauth2- jpa-example

I've tried to add the users and authentication with OAuth. I followed by tutorial: Video Here is his source code: https://github.com/arocketman/Spring-oauth2-jpa-example

我的表现完全和他一样,但是我的Intellij给我展示了一些问题.

I've done exactly like him but my Intellij showed me some issuses.

我不得不从以下位置更改我的pom.xml

I had to change my pom.xml from

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>

        <dependency>
            <groupId>org.springframework.security.oauth.boot</groupId>
            <artifactId>spring-security-oauth2-autoconfigure</artifactId>
            <version>2.1.6.RELEASE</version>
        </dependency>

只需解决无法解析我的配置文件中的oauth2 symbol.

Just to fix "Can not resolve oauth2 symbol in my configuration files.

但是现在的问题是,每个getSomethingsetSomething都标记为红色.

But now the problem is that every getSomething or setSomething is marked red.

Error:(12, 12) java: class com.github.Spring.Blog.config.ResourceServerConfig is already defined in package com.github.Spring.Blog.config
Error:(3, 48) java: package jdk.nashorn.internal.objects.annotations does not exist
Error:(4, 48) java: package jdk.nashorn.internal.objects.annotations does not exist
Error:(18, 2) java: cannot find symbol
  symbol: class Getter
Error:(19, 2) java: cannot find symbol
  symbol: class Setter
Error:(3, 48) java: package jdk.nashorn.internal.objects.annotations does not exist
Error:(4, 48) java: package jdk.nashorn.internal.objects.annotations does not exist
Error:(14, 2) java: cannot find symbol
  symbol: class Getter
Error:(15, 2) java: cannot find symbol
  symbol: class Setter
...

这是我的源代码: https://github.com/Incybro/Spring-Blog

在安装了lombok并将导入更改为import lombok.*;

After installing lombok and changing imports to import lombok.*;

C:\Users\Admin\Desktop\Spring-Blog\src\main\java\com\github\Spring\Blog\config\ResourceServerConfig.java
Error:(12, 12) java: class com.github.Spring.Blog.config.ResourceServerConfig is already defined in package com.github.Spring.Blog.config
C:\Users\Admin\Desktop\Spring-Blog\src\main\java\com\github\Spring\Blog\services\UserService.java
Error:(20, 53) java: cannot find symbol
  symbol:   method getPassword()
  location: variable user of type com.github.Spring.Blog.entities.User
C:\Users\Admin\Desktop\Spring-Blog\src\main\java\com\github\Spring\Blog\SpringBlogApplication.java
Error:(27, 55) java: constructor Role in class com.github.Spring.Blog.entities.Role cannot be applied to given types;
  required: no arguments
  found: java.lang.String
  reason: actual and formal argument lists differ in length
Error:(27, 73) java: constructor Role in class com.github.Spring.Blog.entities.Role cannot be applied to given types;
  required: no arguments
  found: java.lang.String
  reason: actual and formal argument lists differ in length
C:\Users\Admin\Desktop\Spring-Blog\src\main\java\com\github\Spring\Blog\services\CustomUserDetailsService.java
Error:(29, 26) java: cannot find symbol
  symbol:   method getUsername()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(30, 26) java: cannot find symbol
  symbol:   method getPassword()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(31, 26) java: cannot find symbol
  symbol:   method isActive()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(32, 26) java: cannot find symbol
  symbol:   method isActive()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(33, 26) java: cannot find symbol
  symbol:   method isActive()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(34, 26) java: cannot find symbol
  symbol:   method isActive()
  location: variable u of type com.github.Spring.Blog.entities.User
Error:(36, 34) java: cannot find symbol
  symbol:   method getRoles()
  location: variable u of type com.github.Spring.Blog.entities.User

推荐答案

我认为您需要在IDE中添加lombok插件. 添加插件

i think you need to add lombok plugin in your IDE. to add plugin

  • 转到文件">设置">插件"
  • 单击浏览存储库...
  • 搜索Lombok插件
  • 点击安装插件
  • 重新启动IntelliJ IDEA

有关详细信息,请参见此处

了解详情

这篇关于找不到@Getter和@Setter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆