Reputation: 1324
Hi I have configured my app as per https://github.com/spring-projects/spring-data-examples/tree/master/rest/headers but when I check the responses to my entities the last modified header is not coming even though I have setup everything correctly . Code below domain class
@Data
@Entity(name = "SHORES_TBL")
@EntityListeners(AuditingEntityListener.class)
public class Shores {
@EmbeddedId
private ShoresKey key;
/* some fields */
@ManyToOne
@MapsId("shoreId")
@JoinColumn(name = "shore_id", columnDefinition = "varchar2(12)")
private Fund fund;
private @JsonIgnore @LastModifiedDate Date updTs;
}
spring boot application config
@SpringBootApplication
// Explicitly enable entity links as Boot fails to auto-configure them
@EnableEntityLinks
@EnableJpaAuditing
public class Services extends SpringBootServletInitializer {
/**
some config
**/
public static void main(String[] args) {
SpringApplication.run(Services.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Services.class);
}
}
but in the test cases I am not getting the LAST_MODIFIED header
MockHttpServletResponse response = mvc.perform(get(uri)).//
andDo(print()).//
andReturn().getResponse();
pom config
<properties>
<spring-data-releasetrain.version>Gosling-BUILD-SNAPSHOT</spring-data-releasetrain.version>
<spring.version>4.2.0.RC1</spring.version>
<java.version>1.8</java.version>
<spring-hateoas.version>0.18.0.BUILD-SNAPSHOT</spring-hateoas.version>
<json-path.version>1.2.0</json-path.version>
</properties>
any idea what I am missing here the updTs is in the db and is populated as the updated timestamp .
Upvotes: 1
Views: 755
Reputation: 1324
It finally worked seems I was using the wrong version switched to spring boot 1.3.0.BUILD-SNAPSHOT and now it works like a charm .
use POM
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
Upvotes: 2