質問編集履歴
2
gradle.buildの中身を追記
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -62,6 +62,36 @@ 
     | 
|
| 
       62 
62 
     | 
    
         
             
            }
         
     | 
| 
       63 
63 
     | 
    
         
             
            ```
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
            (追記)
         
     | 
| 
      
 66 
     | 
    
         
            +
            IDEは使用しておらずGradleを使ってビルドをしました。
         
     | 
| 
      
 67 
     | 
    
         
            +
            build.gradleファイルの中身は下記です。
         
     | 
| 
      
 68 
     | 
    
         
            +
            参照元のqiita記事にあるbuild.gradleファイルの中身だとcompileメソッドがないとエラーが出ましたので、Springのinitializerを使って作成したbuild.gradleの中身をそのまま持ってきております。
         
     | 
| 
      
 69 
     | 
    
         
            +
            ```build.gradle
         
     | 
| 
      
 70 
     | 
    
         
            +
            plugins {
         
     | 
| 
      
 71 
     | 
    
         
            +
            	id 'org.springframework.boot' version '2.7.4'
         
     | 
| 
      
 72 
     | 
    
         
            +
            	id 'io.spring.dependency-management' version '1.0.14.RELEASE'
         
     | 
| 
      
 73 
     | 
    
         
            +
            	id 'java'
         
     | 
| 
      
 74 
     | 
    
         
            +
            }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            group = 'com.example'
         
     | 
| 
      
 77 
     | 
    
         
            +
            version = '0.0.1-SNAPSHOT'
         
     | 
| 
      
 78 
     | 
    
         
            +
            sourceCompatibility = '1.8'
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            repositories {
         
     | 
| 
      
 81 
     | 
    
         
            +
            	mavenCentral()
         
     | 
| 
      
 82 
     | 
    
         
            +
            }
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            dependencies {
         
     | 
| 
      
 85 
     | 
    
         
            +
            	implementation 'org.springframework.boot:spring-boot-starter-data-redis'
         
     | 
| 
      
 86 
     | 
    
         
            +
            	implementation 'org.springframework.boot:spring-boot-starter-web'
         
     | 
| 
      
 87 
     | 
    
         
            +
            	testImplementation 'org.springframework.boot:spring-boot-starter-test'
         
     | 
| 
      
 88 
     | 
    
         
            +
            }
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
            tasks.named('test') {
         
     | 
| 
      
 91 
     | 
    
         
            +
            	useJUnitPlatform()
         
     | 
| 
      
 92 
     | 
    
         
            +
            }
         
     | 
| 
      
 93 
     | 
    
         
            +
            ```
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
       65 
95 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
       66 
96 
     | 
    
         
             
            import java.util.List;
         
     | 
| 
       67 
97 
     | 
    
         
             
            import java.util.Map;
         
     | 
| 
         @@ -81,6 +111,7 @@ 
     | 
|
| 
       81 
111 
     | 
    
         
             
              symbol: class Data
         
     | 
| 
       82 
112 
     | 
    
         | 
| 
       83 
113 
     | 
    
         
             
            といったエラーが出てしまいます…。
         
     | 
| 
      
 114 
     | 
    
         
            +
            (追記)
         
     | 
| 
       84 
115 
     | 
    
         
             
            エラー全文はこちらです。
         
     | 
| 
       85 
116 
     | 
    
         
             
            ```java
         
     | 
| 
       86 
117 
     | 
    
         
             
            > Task :compileJava FAILED
         
     | 
1
エラー全文を追記しました
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -70,15 +70,96 @@ 
     | 
|
| 
       70 
70 
     | 
    
         
             
            import org.springframework.context.annotation;
         
     | 
| 
       71 
71 
     | 
    
         
             
            を追加しましたが、
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            RedisSampleData.java: 
     | 
| 
      
 73 
     | 
    
         
            +
            RedisSampleData.java:4: error: package lombok does not exist
         
     | 
| 
       74 
74 
     | 
    
         
             
            import lombok.Data;
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
            や、
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
            java: 
     | 
| 
      
 78 
     | 
    
         
            +
            java:6: error: cannot find symbol
         
     | 
| 
       79 
79 
     | 
    
         
             
            @Data
         
     | 
| 
       80 
80 
     | 
    
         
             
             ^
         
     | 
| 
       81 
81 
     | 
    
         
             
              symbol: class Data
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
            といったエラーが出てしまいます…。
         
     | 
| 
      
 84 
     | 
    
         
            +
            エラー全文はこちらです。
         
     | 
| 
      
 85 
     | 
    
         
            +
            ```java
         
     | 
| 
      
 86 
     | 
    
         
            +
            > Task :compileJava FAILED
         
     | 
| 
      
 87 
     | 
    
         
            +
            /src/main/java/RedisSampleData.java:4: error: package lombok does not exist
         
     | 
| 
      
 88 
     | 
    
         
            +
            import lombok.Data;
         
     | 
| 
      
 89 
     | 
    
         
            +
                         ^
         
     | 
| 
      
 90 
     | 
    
         
            +
            /src/main/java/RedisSampleData.java:6: error: cannot find symbol
         
     | 
| 
      
 91 
     | 
    
         
            +
            @Data
         
     | 
| 
      
 92 
     | 
    
         
            +
             ^
         
     | 
| 
      
 93 
     | 
    
         
            +
              symbol: class Data
         
     | 
| 
      
 94 
     | 
    
         
            +
            /src/main/java/RedisSampleData.java:7: error: cannot find symbol
         
     | 
| 
      
 95 
     | 
    
         
            +
            @Getter
         
     | 
| 
      
 96 
     | 
    
         
            +
             ^
         
     | 
| 
      
 97 
     | 
    
         
            +
              symbol: class Getter
         
     | 
| 
      
 98 
     | 
    
         
            +
            /src/main/java/RedisSampleData.java:8: error: cannot find symbol
         
     | 
| 
      
 99 
     | 
    
         
            +
            @Setter
         
     | 
| 
      
 100 
     | 
    
         
            +
             ^
         
     | 
| 
      
 101 
     | 
    
         
            +
              symbol: class Setter
         
     | 
| 
      
 102 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:3: error: cannot find symbol
         
     | 
| 
      
 103 
     | 
    
         
            +
            import org.springframework.data.redis.core;
         
     | 
| 
      
 104 
     | 
    
         
            +
                                                 ^
         
     | 
| 
      
 105 
     | 
    
         
            +
              symbol:   class core
         
     | 
| 
      
 106 
     | 
    
         
            +
              location: package org.springframework.data.redis
         
     | 
| 
      
 107 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:4: error: cannot find symbol
         
     | 
| 
      
 108 
     | 
    
         
            +
            import org.springframework.context.annotation;
         
     | 
| 
      
 109 
     | 
    
         
            +
                                              ^
         
     | 
| 
      
 110 
     | 
    
         
            +
              symbol:   class annotation
         
     | 
| 
      
 111 
     | 
    
         
            +
              location: package org.springframework.context
         
     | 
| 
      
 112 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:6: error: cannot find symbol
         
     | 
| 
      
 113 
     | 
    
         
            +
            @RestController
         
     | 
| 
      
 114 
     | 
    
         
            +
             ^
         
     | 
| 
      
 115 
     | 
    
         
            +
              symbol: class RestController
         
     | 
| 
      
 116 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:7: error: cannot find symbol
         
     | 
| 
      
 117 
     | 
    
         
            +
            @RequestMapping(value = "/SampleRedis")
         
     | 
| 
      
 118 
     | 
    
         
            +
             ^
         
     | 
| 
      
 119 
     | 
    
         
            +
              symbol: class RequestMapping
         
     | 
| 
      
 120 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:11: error: cannot find symbol
         
     | 
| 
      
 121 
     | 
    
         
            +
                private StringRedisTemplate redisTemplate;
         
     | 
| 
      
 122 
     | 
    
         
            +
                        ^
         
     | 
| 
      
 123 
     | 
    
         
            +
              symbol:   class StringRedisTemplate
         
     | 
| 
      
 124 
     | 
    
         
            +
              location: class RedisSampleController
         
     | 
| 
      
 125 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:10: error: cannot find symbol
         
     | 
| 
      
 126 
     | 
    
         
            +
                @Autowired
         
     | 
| 
      
 127 
     | 
    
         
            +
                 ^
         
     | 
| 
      
 128 
     | 
    
         
            +
              symbol:   class Autowired
         
     | 
| 
      
 129 
     | 
    
         
            +
              location: class RedisSampleController
         
     | 
| 
      
 130 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:14: error: cannot find symbol
         
     | 
| 
      
 131 
     | 
    
         
            +
                public void post(@RequestBody RedisSampleData redisSampleData) {
         
     | 
| 
      
 132 
     | 
    
         
            +
                                  ^
         
     | 
| 
      
 133 
     | 
    
         
            +
              symbol:   class RequestBody
         
     | 
| 
      
 134 
     | 
    
         
            +
              location: class RedisSampleController
         
     | 
| 
      
 135 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:13: error: cannot find symbol
         
     | 
| 
      
 136 
     | 
    
         
            +
                @PostMapping
         
     | 
| 
      
 137 
     | 
    
         
            +
                 ^
         
     | 
| 
      
 138 
     | 
    
         
            +
              symbol:   class PostMapping
         
     | 
| 
      
 139 
     | 
    
         
            +
              location: class RedisSampleController
         
     | 
| 
      
 140 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:27: error: cannot find symbol
         
     | 
| 
      
 141 
     | 
    
         
            +
                @GetMapping
         
     | 
| 
      
 142 
     | 
    
         
            +
                 ^
         
     | 
| 
      
 143 
     | 
    
         
            +
              symbol:   class GetMapping
         
     | 
| 
      
 144 
     | 
    
         
            +
              location: class RedisSampleController
         
     | 
| 
      
 145 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:17: error: cannot find symbol
         
     | 
| 
      
 146 
     | 
    
         
            +
                            .set("redis-tutorial:string", redisSampleData.getString());
         
     | 
| 
      
 147 
     | 
    
         
            +
                                                                         ^
         
     | 
| 
      
 148 
     | 
    
         
            +
              symbol:   method getString()
         
     | 
| 
      
 149 
     | 
    
         
            +
              location: variable redisSampleData of type RedisSampleData
         
     | 
| 
      
 150 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:21: error: cannot find symbol
         
     | 
| 
      
 151 
     | 
    
         
            +
                                    redisSampleData.getList().toArray(new String[0]));
         
     | 
| 
      
 152 
     | 
    
         
            +
                                                   ^
         
     | 
| 
      
 153 
     | 
    
         
            +
              symbol:   method getList()
         
     | 
| 
      
 154 
     | 
    
         
            +
              location: variable redisSampleData of type RedisSampleData
         
     | 
| 
      
 155 
     | 
    
         
            +
            /src/main/java/RedisSampleController.java:24: error: cannot find symbol
         
     | 
| 
      
 156 
     | 
    
         
            +
                            .putAll("redis-tutorial:map", redisSampleData.getMap());
         
     | 
| 
      
 157 
     | 
    
         
            +
                                                                         ^
         
     | 
| 
      
 158 
     | 
    
         
            +
              symbol:   method getMap()
         
     | 
| 
      
 159 
     | 
    
         
            +
              location: variable redisSampleData of type RedisSampleData
         
     | 
| 
      
 160 
     | 
    
         
            +
            16 errors
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            ```
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
       84 
165 
     | 
    
         
             
            そもそもアノテーションを使用する際はimportが必要なのでしょうか?ビルドファイル(gradle,buildやpom.xmlに記載すればいいのかと思ってました)import必要だとして、org.springframework.context.annotationが必要と言っているものや、lombokが必要と言っているものがあり、(手元ではどちらも失敗しており)恥ずかしながら混乱しております、、
         
     |