Spring boot aws上未公开spring数据rest端点
我已经在aws elasticbeanstalk上部署了我的应用程序,当我访问它时,它会显示应用程序的所有存储库,但当我在某个时间之后访问相同的url时 在my repository中显示以下json而不显示该方法:Spring boot aws上未公开spring数据rest端点,spring-boot,spring-data-jpa,amazon-elastic-beanstalk,Spring Boot,Spring Data Jpa,Amazon Elastic Beanstalk,我已经在aws elasticbeanstalk上部署了我的应用程序,当我访问它时,它会显示应用程序的所有存储库,但当我在某个时间之后访问相同的url时 在my repository中显示以下json而不显示该方法: { "_links" : { "profile" : { "href" : "http://springfullstack-env-1.eba-m4suzyhc.ap-south-1.elasticbeanstalk.com/
{
"_links" : {
"profile" : {
"href" : "http://springfullstack-env-1.eba-m4suzyhc.ap-south-1.elasticbeanstalk.com/api/profile"
}
}
}
当我在aws上重新启动ebs应用程序时,它会再次显示所有存储库
下面是主要的方法类
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootEcommerceApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootEcommerceApplication.class, args);
}
}
这是我的实体类
package com.mycode.ecommerce.entity;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name="product")
@Data
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@ManyToOne
@JoinColumn(name = "category_id", nullable = false)
private ProductCategory category;
@Column(name = "sku")
private String sku;
@Column(name = "name")
private String name;
@Column(name = "description")
private String description;
@Column(name = "unit_price")
private BigDecimal unitPrice;
@Column(name = "image_url")
private String imageUrl;
@Column(name = "active")
private boolean active;
@Column(name = "units_in_stock")
private int unitsInStock;
@Column(name = "date_created")
@CreationTimestamp
private Date dateCreated;
@Column(name = "last_updated")
@UpdateTimestamp
private Date lastUpdated;
}
这是我的存储库类
package com.mycode.ecommerce.dao;
import com.mycode.ecommerce.entity.Product;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestParam;
@CrossOrigin
public interface ProductRepository extends JpaRepository<Product, Long> {
Page<Product> findByCategoryId(@RequestParam("id") Long id, Pageable pageable);
Page<Product> findByNameContaining(@RequestParam("name") String name, Pageable pageable);
}
package com.mycode.ecommerce.dao;
导入com.mycode.ecommerce.entity.Product;
导入org.springframework.data.domain.Page;
导入org.springframework.data.domain.Pageable;
导入org.springframework.data.jpa.repository.JpaRepository;
导入org.springframework.web.bind.annotation.CrossOrigin;
导入org.springframework.web.bind.annotation.RequestParam;
@交叉起源
公共接口ProductRepository扩展了JpaRepository{
PageFindByCategoryId(@RequestParam(“id”)长id,可分页;
页面findByNameContaining(@RequestParam(“name”)字符串名称,可分页;
}