Dror
Dror

Reputation: 5505

@SpringBootApplication not recognized when using spring-boot-starter-parent version 1.5.9.RELEASE

from SPRING STS I've created a fresh spring boot project starter , I've added "WEB" feature, and then finished creating the project

for some reason the import

import org.springframework.boot.autoconfigure.SpringBootApplication;

is not recognized (I get -" The import org.springframework.boot.autoconfigure.SpringBootApplication cannot be resolved")

and thus the @SpringBootApplication annotation is also unrecognized

package com.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

    @SpringBootApplication
    public class Newtest1sdfsdfApplication {

        public static void main(String[] args) {
            SpringApplication.run(Newtest1sdfsdfApplication.class, args);
        }
    }

NOTE: I'm using the project that was automatically created

if i change the project version of spring-boot-starter-parent (in pom.xml) from 1.5.9 to 1.5.8 - all is well again. setting back to 1.5.9 shows the error

meaning changing from :

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

to

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Any ideas what's the issue here?

Upvotes: 1

Views: 7558

Answers (1)

Dror
Dror

Reputation: 5505

I ended up :

  1. deleting two sub-folders from inside the .m2 folder The sub-folders were : org and com

  2. and then -> from eclipse/STS : Right-click the Project name -> MAVEN -> UPDATE PROJECT

Upvotes: 3

Related Questions