19 changed files with 173 additions and 15 deletions
@ -0,0 +1,44 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2012-present the original author or authors. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
plugins { |
||||||
|
id "java-library" |
||||||
|
id "org.springframework.boot.auto-configuration" |
||||||
|
id "org.springframework.boot.configuration-properties" |
||||||
|
id "org.springframework.boot.deployed" |
||||||
|
id "org.springframework.boot.optional-dependencies" |
||||||
|
} |
||||||
|
|
||||||
|
description = "Spring Boot Data REST" |
||||||
|
|
||||||
|
dependencies { |
||||||
|
api(project(":spring-boot-project:spring-boot-webmvc")) |
||||||
|
api(project(":spring-boot-project:spring-boot-jackson")) |
||||||
|
api("org.springframework.data:spring-data-rest-webmvc") |
||||||
|
|
||||||
|
optional(project(":spring-boot-project:spring-boot-autoconfigure")) |
||||||
|
|
||||||
|
testImplementation(project(":spring-boot-project:spring-boot-data-jpa")) |
||||||
|
testImplementation(project(":spring-boot-project:spring-boot-test")) |
||||||
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) |
||||||
|
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure"))) |
||||||
|
testImplementation("jakarta.servlet:jakarta.servlet-api") |
||||||
|
|
||||||
|
testRuntimeOnly("ch.qos.logback:logback-classic") |
||||||
|
testRuntimeOnly("com.h2database:h2") |
||||||
|
testRuntimeOnly("com.zaxxer:HikariCP") |
||||||
|
} |
||||||
7
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java → spring-boot-project/spring-boot-data-rest/src/main/java/org/springframework/boot/data/rest/autoconfigure/RepositoryRestMvcAutoConfiguration.java
7
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java → spring-boot-project/spring-boot-data-rest/src/main/java/org/springframework/boot/data/rest/autoconfigure/RepositoryRestMvcAutoConfiguration.java
2
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestConfigurer.java → spring-boot-project/spring-boot-data-rest/src/main/java/org/springframework/boot/data/rest/autoconfigure/SpringBootRepositoryRestConfigurer.java
2
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestConfigurer.java → spring-boot-project/spring-boot-data-rest/src/main/java/org/springframework/boot/data/rest/autoconfigure/SpringBootRepositoryRestConfigurer.java
@ -0,0 +1 @@ |
|||||||
|
org.springframework.boot.data.rest.autoconfigure.RepositoryRestMvcAutoConfiguration |
||||||
4
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java → spring-boot-project/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/autoconfigure/RepositoryRestMvcAutoConfigurationTests.java
4
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java → spring-boot-project/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/autoconfigure/RepositoryRestMvcAutoConfigurationTests.java
@ -0,0 +1,76 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2012-present the original author or authors. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.springframework.boot.data.rest.domain.city; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import jakarta.persistence.Column; |
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
|
||||||
|
@Entity |
||||||
|
public class City implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@Id |
||||||
|
@GeneratedValue |
||||||
|
private Long id; |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
private String name; |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
private String state; |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
private String country; |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
private String map; |
||||||
|
|
||||||
|
protected City() { |
||||||
|
} |
||||||
|
|
||||||
|
public City(String name, String country) { |
||||||
|
this.name = name; |
||||||
|
this.country = country; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return this.name; |
||||||
|
} |
||||||
|
|
||||||
|
public String getState() { |
||||||
|
return this.state; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCountry() { |
||||||
|
return this.country; |
||||||
|
} |
||||||
|
|
||||||
|
public String getMap() { |
||||||
|
return this.map; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return getName() + "," + getState() + "," + getCountry(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2012-present the original author or authors. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.springframework.boot.data.rest.domain.city; |
||||||
|
|
||||||
|
import org.springframework.data.domain.Page; |
||||||
|
import org.springframework.data.domain.Pageable; |
||||||
|
import org.springframework.data.jpa.repository.JpaRepository; |
||||||
|
|
||||||
|
public interface CityRepository extends JpaRepository<City, Long> { |
||||||
|
|
||||||
|
@Override |
||||||
|
Page<City> findAll(Pageable pageable); |
||||||
|
|
||||||
|
Page<City> findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country, Pageable pageable); |
||||||
|
|
||||||
|
City findByNameAndCountryAllIgnoringCase(String name, String country); |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue