I have an application that takes a InitializeCompnents();
value as follows:
@QueryParam
When I call this method through the following URL value is import javax.ws.rs.*
//Some stuff here
@POST
@Path("/mypath")
public Response generate(
@QueryParam("value") String value) {
// value is always null here.
}
:
null
答案 0 :(得分:-1)
While the import javax.ws.rs.* does not cause the compiler to complain, javax.ws.rs.QueryParm import does not happen. As such, change the imports to this:
package com.my-company.my-spring-app.domain;
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* City generated by hbm2java
*/
@Entity
@Table(name = "city",
schema = "public",
uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class City implements java.io.Serializable {
private static final long serialVersionUID = 4674557242772722625L;
@Id
@SequenceGenerator(name = "city_gen",
schema = "public",
sequenceName = "city_id_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "city_gen")
@Column(name = "id",
unique = true,
nullable = false)
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "countryid",
nullable = false)
// @JoinColumn(name = "country_id", nullable = false)
private Country country;
@Column(name = "name",
unique = true,
length = 200)
private String name;
...
}
Then the value comes in.