Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In response getting empty using ResponseEntity in springboot #3564

Open
giteshkumar143 opened this issue Dec 27, 2024 · 1 comment
Open

In response getting empty using ResponseEntity in springboot #3564

giteshkumar143 opened this issue Dec 27, 2024 · 1 comment
Labels
status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug

Comments

@giteshkumar143
Copy link

My Controller class

package com.lcwd.rating.controllers;

import com.lcwd.rating.entities.Rating;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ratings")
public class RatingCotroller {

@PostMapping
public ResponseEntity<Rating> createRating(@RequestBody Rating rating){
    System.out.println("method call");
    return ResponseEntity.status(HttpStatus.CREATED).body(rating);

}

}

entity class

package com.lcwd.rating.entities;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@JsonAutoDetect(getterVisibility= JsonAutoDetect.Visibility.NONE)
public class Rating {
private String ratingId;
}


application.yml
server:
port: 8083

pom file


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.4.1


com.lcwd.rating
RatingService
0.0.1-SNAPSHOT
RatingService
This is rating service for storing rating related information














<java.version>17</java.version>



org.springframework.boot
spring-boot-starter-web

	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<annotationProcessorPaths>
					<path>
						<groupId>org.projectlombok</groupId>
						<artifactId>lombok</artifactId>
					</path>
				</annotationProcessorPaths>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<configuration>
				<excludes>
					<exclude>
						<groupId>org.projectlombok</groupId>
						<artifactId>lombok</artifactId>
					</exclude>
				</excludes>
			</configuration>
		</plugin>
	</plugins>
</build>
rating-issue
@giteshkumar143 giteshkumar143 added status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug labels Dec 27, 2024
@giteshkumar143 giteshkumar143 changed the title In response getting empty using In response getting empty using ResponseEntity in springboot Dec 27, 2024
@giteshkumar143
Copy link
Author

Can help someone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant