localhost:8080/greeting does not respond










0















I am trying to make an example for the REST service from



https://spring.io/guides/gs/rest-service/



I have created all the 3 classes



Package explorer view



I am sharing the code. I have seen the other question where there was a problem with the different packages but my classes are in the same package.



Application Class



GreetingController Class



Greeting Class



After i run the program i get the following result:



Console



I see that the console says terminated so i do not know if this is the reason why i can not access the localhost:8080/greeting and i get that the site can't be reached



Site Err



This project is built from Spring Tool 4 cause in Eclipse i get an error when i try to select from Projects the "Import Spring Getting Started Content", but this is a second problem.



enter image description here



The console gives the next:






. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown





buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile("junit:junit")



I haven't changed the gradle file. There is nothing in the tutorial about Gradle file



After your proposal to add



compile("org.springframework.boot:spring-boot-starter-web") 


on gradle file when i run the application from IDE the program is terminated.



The same with maven from command.



Only gradle (gradle bootRun) from command line works and keeps running so the browser responses. SO what it is killing the app in these cases?










share|improve this question
























  • What happens when you run through command line? e.g ./gradlew bootRun

    – Eamon Scullion
    Nov 12 '18 at 17:16











  • Even with gradlew and with maven it downloads some files and there is the same output as i attached.

    – kyrpav
    Nov 12 '18 at 17:28











  • I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

    – Eamon Scullion
    Nov 12 '18 at 17:35











  • do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

    – Grinish Nepal
    Nov 12 '18 at 18:00











  • i have added the console response. I do not understand why someone need to give a -1 rating

    – kyrpav
    Nov 12 '18 at 18:09















0















I am trying to make an example for the REST service from



https://spring.io/guides/gs/rest-service/



I have created all the 3 classes



Package explorer view



I am sharing the code. I have seen the other question where there was a problem with the different packages but my classes are in the same package.



Application Class



GreetingController Class



Greeting Class



After i run the program i get the following result:



Console



I see that the console says terminated so i do not know if this is the reason why i can not access the localhost:8080/greeting and i get that the site can't be reached



Site Err



This project is built from Spring Tool 4 cause in Eclipse i get an error when i try to select from Projects the "Import Spring Getting Started Content", but this is a second problem.



enter image description here



The console gives the next:






. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown





buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile("junit:junit")



I haven't changed the gradle file. There is nothing in the tutorial about Gradle file



After your proposal to add



compile("org.springframework.boot:spring-boot-starter-web") 


on gradle file when i run the application from IDE the program is terminated.



The same with maven from command.



Only gradle (gradle bootRun) from command line works and keeps running so the browser responses. SO what it is killing the app in these cases?










share|improve this question
























  • What happens when you run through command line? e.g ./gradlew bootRun

    – Eamon Scullion
    Nov 12 '18 at 17:16











  • Even with gradlew and with maven it downloads some files and there is the same output as i attached.

    – kyrpav
    Nov 12 '18 at 17:28











  • I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

    – Eamon Scullion
    Nov 12 '18 at 17:35











  • do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

    – Grinish Nepal
    Nov 12 '18 at 18:00











  • i have added the console response. I do not understand why someone need to give a -1 rating

    – kyrpav
    Nov 12 '18 at 18:09













0












0








0








I am trying to make an example for the REST service from



https://spring.io/guides/gs/rest-service/



I have created all the 3 classes



Package explorer view



I am sharing the code. I have seen the other question where there was a problem with the different packages but my classes are in the same package.



Application Class



GreetingController Class



Greeting Class



After i run the program i get the following result:



Console



I see that the console says terminated so i do not know if this is the reason why i can not access the localhost:8080/greeting and i get that the site can't be reached



Site Err



This project is built from Spring Tool 4 cause in Eclipse i get an error when i try to select from Projects the "Import Spring Getting Started Content", but this is a second problem.



enter image description here



The console gives the next:






. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown





buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile("junit:junit")



I haven't changed the gradle file. There is nothing in the tutorial about Gradle file



After your proposal to add



compile("org.springframework.boot:spring-boot-starter-web") 


on gradle file when i run the application from IDE the program is terminated.



The same with maven from command.



Only gradle (gradle bootRun) from command line works and keeps running so the browser responses. SO what it is killing the app in these cases?










share|improve this question
















I am trying to make an example for the REST service from



https://spring.io/guides/gs/rest-service/



I have created all the 3 classes



Package explorer view



I am sharing the code. I have seen the other question where there was a problem with the different packages but my classes are in the same package.



Application Class



GreetingController Class



Greeting Class



After i run the program i get the following result:



Console



I see that the console says terminated so i do not know if this is the reason why i can not access the localhost:8080/greeting and i get that the site can't be reached



Site Err



This project is built from Spring Tool 4 cause in Eclipse i get an error when i try to select from Projects the "Import Spring Getting Started Content", but this is a second problem.



enter image description here



The console gives the next:






. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown





buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile("junit:junit")



I haven't changed the gradle file. There is nothing in the tutorial about Gradle file



After your proposal to add



compile("org.springframework.boot:spring-boot-starter-web") 


on gradle file when i run the application from IDE the program is terminated.



The same with maven from command.



Only gradle (gradle bootRun) from command line works and keeps running so the browser responses. SO what it is killing the app in these cases?






. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown





. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)

2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : Starting Application on ACL_GRE_PavlidisK with PID 20324 (C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initialtargetclasses started by KyriakosP in C:UsersKyriakosPWorkSpacesSpringToolgs-consuming-rest-initial)
2018-11-12 19:03:36.968 INFO 20324 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2018-11-12 19:03:37.015 INFO 20324 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.701 INFO 20324 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-11-12 19:03:37.705 INFO 20324 --- [ main] hello.Application : Started Application in 0.991 seconds (JVM running for 1.338)
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@21a947fe: startup date [Mon Nov 12 19:03:37 CET 2018]; root of context hierarchy
2018-11-12 19:03:37.705 INFO 20324 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown






spring rest web-services spring-mvc spring-boot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 18:58







kyrpav

















asked Nov 12 '18 at 17:08









kyrpavkyrpav

1451223




1451223












  • What happens when you run through command line? e.g ./gradlew bootRun

    – Eamon Scullion
    Nov 12 '18 at 17:16











  • Even with gradlew and with maven it downloads some files and there is the same output as i attached.

    – kyrpav
    Nov 12 '18 at 17:28











  • I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

    – Eamon Scullion
    Nov 12 '18 at 17:35











  • do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

    – Grinish Nepal
    Nov 12 '18 at 18:00











  • i have added the console response. I do not understand why someone need to give a -1 rating

    – kyrpav
    Nov 12 '18 at 18:09

















  • What happens when you run through command line? e.g ./gradlew bootRun

    – Eamon Scullion
    Nov 12 '18 at 17:16











  • Even with gradlew and with maven it downloads some files and there is the same output as i attached.

    – kyrpav
    Nov 12 '18 at 17:28











  • I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

    – Eamon Scullion
    Nov 12 '18 at 17:35











  • do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

    – Grinish Nepal
    Nov 12 '18 at 18:00











  • i have added the console response. I do not understand why someone need to give a -1 rating

    – kyrpav
    Nov 12 '18 at 18:09
















What happens when you run through command line? e.g ./gradlew bootRun

– Eamon Scullion
Nov 12 '18 at 17:16





What happens when you run through command line? e.g ./gradlew bootRun

– Eamon Scullion
Nov 12 '18 at 17:16













Even with gradlew and with maven it downloads some files and there is the same output as i attached.

– kyrpav
Nov 12 '18 at 17:28





Even with gradlew and with maven it downloads some files and there is the same output as i attached.

– kyrpav
Nov 12 '18 at 17:28













I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

– Eamon Scullion
Nov 12 '18 at 17:35





I can't spot anything wrong with your code, so I would suggest trying different ways of running that the tutorial lists in the building an executable jar section

– Eamon Scullion
Nov 12 '18 at 17:35













do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

– Grinish Nepal
Nov 12 '18 at 18:00





do you see the /greeting being mapped in the startup logs. Also can you add your gradle file to see the dependencies?

– Grinish Nepal
Nov 12 '18 at 18:00













i have added the console response. I do not understand why someone need to give a -1 rating

– kyrpav
Nov 12 '18 at 18:09





i have added the console response. I do not understand why someone need to give a -1 rating

– kyrpav
Nov 12 '18 at 18:09












2 Answers
2






active

oldest

votes


















0














You might want to specify what method of RequestMethod it is:



e.g.



 @RequestMapping(value = "/greeting", method = RequestMethod.GET)


or



 @GetMapping("/greeting")


other than that it look sok to me.



You might want to look if you have the web starter in your build.gradle file.



Example in one file DemoGradleApplication:



package com.example.demogradle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@SpringBootApplication
public class DemoGradleApplication

public static void main(String args)
SpringApplication.run(DemoGradleApplication.class, args);



@RestController
class HelloWorldController

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public Message helloWorld()
return new Message(UUID.randomUUID()
.toString(), "Hello, world!");


@GetMapping("/hello/id:.*$")
public Message hello(@PathVariable("id") String msg)
return new Message(UUID.randomUUID()
.toString(), msg);



@Data
@AllArgsConstructor
class Message

private String id;
private String message;



with gradle file:



buildscript 
ext
springBootVersion = '2.1.0.RELEASE'

repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories
mavenCentral()



dependencies
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')



Run with:



gradlew bootRun


Goto url http://localhost:8080/hello or http://localhost:8080/hello/you all rocking people in a browser






share|improve this answer

























  • In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

    – kyrpav
    Nov 12 '18 at 17:31












  • A you see no web starter so no web possibilities.

    – Ivonet
    Nov 12 '18 at 17:32











  • For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

    – kyrpav
    Nov 12 '18 at 17:33











  • It is still better to be explicit in java then implicit :-)

    – Ivonet
    Nov 12 '18 at 17:35











  • Just updated with a whole example :-)

    – Ivonet
    Nov 12 '18 at 17:43


















0














Try to replace your gradle



buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile('org.springframework.boot:spring-boot-starter-test')



Also as spring boot document says you should locate you main application class in the root package above other class. Just a thought for you to work on.



This is the official spring boot doc:-
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html#using-boot-locating-the-main-class






share|improve this answer

























  • You can write a whole application in the same package even within the same file.

    – Ivonet
    Nov 12 '18 at 17:31











  • I just mentioned what is part of the spring docs

    – Grinish Nepal
    Nov 12 '18 at 17:46










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266954%2flocalhost8080-greeting-does-not-respond%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You might want to specify what method of RequestMethod it is:



e.g.



 @RequestMapping(value = "/greeting", method = RequestMethod.GET)


or



 @GetMapping("/greeting")


other than that it look sok to me.



You might want to look if you have the web starter in your build.gradle file.



Example in one file DemoGradleApplication:



package com.example.demogradle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@SpringBootApplication
public class DemoGradleApplication

public static void main(String args)
SpringApplication.run(DemoGradleApplication.class, args);



@RestController
class HelloWorldController

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public Message helloWorld()
return new Message(UUID.randomUUID()
.toString(), "Hello, world!");


@GetMapping("/hello/id:.*$")
public Message hello(@PathVariable("id") String msg)
return new Message(UUID.randomUUID()
.toString(), msg);



@Data
@AllArgsConstructor
class Message

private String id;
private String message;



with gradle file:



buildscript 
ext
springBootVersion = '2.1.0.RELEASE'

repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories
mavenCentral()



dependencies
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')



Run with:



gradlew bootRun


Goto url http://localhost:8080/hello or http://localhost:8080/hello/you all rocking people in a browser






share|improve this answer

























  • In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

    – kyrpav
    Nov 12 '18 at 17:31












  • A you see no web starter so no web possibilities.

    – Ivonet
    Nov 12 '18 at 17:32











  • For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

    – kyrpav
    Nov 12 '18 at 17:33











  • It is still better to be explicit in java then implicit :-)

    – Ivonet
    Nov 12 '18 at 17:35











  • Just updated with a whole example :-)

    – Ivonet
    Nov 12 '18 at 17:43















0














You might want to specify what method of RequestMethod it is:



e.g.



 @RequestMapping(value = "/greeting", method = RequestMethod.GET)


or



 @GetMapping("/greeting")


other than that it look sok to me.



You might want to look if you have the web starter in your build.gradle file.



Example in one file DemoGradleApplication:



package com.example.demogradle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@SpringBootApplication
public class DemoGradleApplication

public static void main(String args)
SpringApplication.run(DemoGradleApplication.class, args);



@RestController
class HelloWorldController

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public Message helloWorld()
return new Message(UUID.randomUUID()
.toString(), "Hello, world!");


@GetMapping("/hello/id:.*$")
public Message hello(@PathVariable("id") String msg)
return new Message(UUID.randomUUID()
.toString(), msg);



@Data
@AllArgsConstructor
class Message

private String id;
private String message;



with gradle file:



buildscript 
ext
springBootVersion = '2.1.0.RELEASE'

repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories
mavenCentral()



dependencies
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')



Run with:



gradlew bootRun


Goto url http://localhost:8080/hello or http://localhost:8080/hello/you all rocking people in a browser






share|improve this answer

























  • In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

    – kyrpav
    Nov 12 '18 at 17:31












  • A you see no web starter so no web possibilities.

    – Ivonet
    Nov 12 '18 at 17:32











  • For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

    – kyrpav
    Nov 12 '18 at 17:33











  • It is still better to be explicit in java then implicit :-)

    – Ivonet
    Nov 12 '18 at 17:35











  • Just updated with a whole example :-)

    – Ivonet
    Nov 12 '18 at 17:43













0












0








0







You might want to specify what method of RequestMethod it is:



e.g.



 @RequestMapping(value = "/greeting", method = RequestMethod.GET)


or



 @GetMapping("/greeting")


other than that it look sok to me.



You might want to look if you have the web starter in your build.gradle file.



Example in one file DemoGradleApplication:



package com.example.demogradle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@SpringBootApplication
public class DemoGradleApplication

public static void main(String args)
SpringApplication.run(DemoGradleApplication.class, args);



@RestController
class HelloWorldController

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public Message helloWorld()
return new Message(UUID.randomUUID()
.toString(), "Hello, world!");


@GetMapping("/hello/id:.*$")
public Message hello(@PathVariable("id") String msg)
return new Message(UUID.randomUUID()
.toString(), msg);



@Data
@AllArgsConstructor
class Message

private String id;
private String message;



with gradle file:



buildscript 
ext
springBootVersion = '2.1.0.RELEASE'

repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories
mavenCentral()



dependencies
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')



Run with:



gradlew bootRun


Goto url http://localhost:8080/hello or http://localhost:8080/hello/you all rocking people in a browser






share|improve this answer















You might want to specify what method of RequestMethod it is:



e.g.



 @RequestMapping(value = "/greeting", method = RequestMethod.GET)


or



 @GetMapping("/greeting")


other than that it look sok to me.



You might want to look if you have the web starter in your build.gradle file.



Example in one file DemoGradleApplication:



package com.example.demogradle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@SpringBootApplication
public class DemoGradleApplication

public static void main(String args)
SpringApplication.run(DemoGradleApplication.class, args);



@RestController
class HelloWorldController

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public Message helloWorld()
return new Message(UUID.randomUUID()
.toString(), "Hello, world!");


@GetMapping("/hello/id:.*$")
public Message hello(@PathVariable("id") String msg)
return new Message(UUID.randomUUID()
.toString(), msg);



@Data
@AllArgsConstructor
class Message

private String id;
private String message;



with gradle file:



buildscript 
ext
springBootVersion = '2.1.0.RELEASE'

repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories
mavenCentral()



dependencies
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')



Run with:



gradlew bootRun


Goto url http://localhost:8080/hello or http://localhost:8080/hello/you all rocking people in a browser







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 17:42

























answered Nov 12 '18 at 17:28









IvonetIvonet

1,207518




1,207518












  • In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

    – kyrpav
    Nov 12 '18 at 17:31












  • A you see no web starter so no web possibilities.

    – Ivonet
    Nov 12 '18 at 17:32











  • For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

    – kyrpav
    Nov 12 '18 at 17:33











  • It is still better to be explicit in java then implicit :-)

    – Ivonet
    Nov 12 '18 at 17:35











  • Just updated with a whole example :-)

    – Ivonet
    Nov 12 '18 at 17:43

















  • In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

    – kyrpav
    Nov 12 '18 at 17:31












  • A you see no web starter so no web possibilities.

    – Ivonet
    Nov 12 '18 at 17:32











  • For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

    – kyrpav
    Nov 12 '18 at 17:33











  • It is still better to be explicit in java then implicit :-)

    – Ivonet
    Nov 12 '18 at 17:35











  • Just updated with a whole example :-)

    – Ivonet
    Nov 12 '18 at 17:43
















In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

– kyrpav
Nov 12 '18 at 17:31






In the build.gradle for dependencies there is dependencies compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") compile("com.fasterxml.jackson.core:jackson-databind") testCompile("junit:junit")

– kyrpav
Nov 12 '18 at 17:31














A you see no web starter so no web possibilities.

– Ivonet
Nov 12 '18 at 17:32





A you see no web starter so no web possibilities.

– Ivonet
Nov 12 '18 at 17:32













For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

– kyrpav
Nov 12 '18 at 17:33





For the @RequestMapping("/greeting") they say in the tutorial that it covers all methods

– kyrpav
Nov 12 '18 at 17:33













It is still better to be explicit in java then implicit :-)

– Ivonet
Nov 12 '18 at 17:35





It is still better to be explicit in java then implicit :-)

– Ivonet
Nov 12 '18 at 17:35













Just updated with a whole example :-)

– Ivonet
Nov 12 '18 at 17:43





Just updated with a whole example :-)

– Ivonet
Nov 12 '18 at 17:43













0














Try to replace your gradle



buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile('org.springframework.boot:spring-boot-starter-test')



Also as spring boot document says you should locate you main application class in the root package above other class. Just a thought for you to work on.



This is the official spring boot doc:-
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html#using-boot-locating-the-main-class






share|improve this answer

























  • You can write a whole application in the same package even within the same file.

    – Ivonet
    Nov 12 '18 at 17:31











  • I just mentioned what is part of the spring docs

    – Grinish Nepal
    Nov 12 '18 at 17:46















0














Try to replace your gradle



buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile('org.springframework.boot:spring-boot-starter-test')



Also as spring boot document says you should locate you main application class in the root package above other class. Just a thought for you to work on.



This is the official spring boot doc:-
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html#using-boot-locating-the-main-class






share|improve this answer

























  • You can write a whole application in the same package even within the same file.

    – Ivonet
    Nov 12 '18 at 17:31











  • I just mentioned what is part of the spring docs

    – Grinish Nepal
    Nov 12 '18 at 17:46













0












0








0







Try to replace your gradle



buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile('org.springframework.boot:spring-boot-starter-test')



Also as spring boot document says you should locate you main application class in the root package above other class. Just a thought for you to work on.



This is the official spring boot doc:-
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html#using-boot-locating-the-main-class






share|improve this answer















Try to replace your gradle



buildscript 
repositories
mavenCentral()

dependencies
classpath("org.springframework.boot:spring-boot-gradle-
plugin:2.0.5.RELEASE")



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar
baseName = 'gs-consuming-rest'
version = '0.1.0'


repositories
mavenCentral()


sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile('org.springframework.boot:spring-boot-starter-test')



Also as spring boot document says you should locate you main application class in the root package above other class. Just a thought for you to work on.



This is the official spring boot doc:-
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html#using-boot-locating-the-main-class







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 18:27

























answered Nov 12 '18 at 17:27









Grinish NepalGrinish Nepal

1,81321235




1,81321235












  • You can write a whole application in the same package even within the same file.

    – Ivonet
    Nov 12 '18 at 17:31











  • I just mentioned what is part of the spring docs

    – Grinish Nepal
    Nov 12 '18 at 17:46

















  • You can write a whole application in the same package even within the same file.

    – Ivonet
    Nov 12 '18 at 17:31











  • I just mentioned what is part of the spring docs

    – Grinish Nepal
    Nov 12 '18 at 17:46
















You can write a whole application in the same package even within the same file.

– Ivonet
Nov 12 '18 at 17:31





You can write a whole application in the same package even within the same file.

– Ivonet
Nov 12 '18 at 17:31













I just mentioned what is part of the spring docs

– Grinish Nepal
Nov 12 '18 at 17:46





I just mentioned what is part of the spring docs

– Grinish Nepal
Nov 12 '18 at 17:46

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266954%2flocalhost8080-greeting-does-not-respond%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế