diff --git a/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/MailController.java b/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/MailController.java index 768a0f8e7b..ff828ca9ec 100644 --- a/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/MailController.java +++ b/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/MailController.java @@ -20,12 +20,10 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -/** - * Created by Olga on 7/20/2016. - */ @Controller @RequestMapping("/mail") public class MailController { + @Autowired public EmailServiceImpl emailService; @@ -33,7 +31,6 @@ public class MailController { private String attachmentPath; @Autowired - @Qualifier("templateSimpleMessage") public SimpleMailMessage template; private static final Map> labels; diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 011de70ad2..8e2db044a6 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -248,8 +248,8 @@ - 4.2.5.RELEASE - 4.0.4.RELEASE + 4.3.4.RELEASE + 4.2.0.RELEASE 2.1.4.RELEASE 2.7.8 diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index 849699cfae..ca51a56633 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -112,6 +112,11 @@ commons-io 2.2 + + com.maxmind.geoip2 + geoip2 + 2.8.0 + @@ -146,7 +151,7 @@ ${maven-surefire-plugin.version} - + **/*IntegrationTest.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java new file mode 100644 index 0000000000..16de4e56f5 --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java @@ -0,0 +1,28 @@ +package com.baeldung.spring.controller; + +import java.io.IOException; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.baeldung.spring.form.GeoIP; +import com.baeldung.spring.service.RawDBDemoGeoIPLocationService; + +@Controller +public class GeoIPTestController { + private RawDBDemoGeoIPLocationService locationService; + public GeoIPTestController() throws IOException { + locationService + = new RawDBDemoGeoIPLocationService(); + } + @RequestMapping(value="/GeoIPTest", method = RequestMethod.POST) + @ResponseBody + public GeoIP getLocation( + @RequestParam(value="ipAddress", required=true) String ipAddress) throws Exception { + + return locationService.getLocation(ipAddress); + } +} diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java new file mode 100644 index 0000000000..19f56867a1 --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java @@ -0,0 +1,56 @@ +package com.baeldung.spring.form; + +public class GeoIP { + private String ipAddress; + private String city; + private String latitude; + private String longitude; + + public GeoIP() { + + } + + public GeoIP(String ipAddress) { + this.ipAddress = ipAddress; + } + + public GeoIP(String ipAddress, String city, String latitude, String longitude) { + this.ipAddress = ipAddress; + this.city = city; + this.latitude = latitude; + this.longitude = longitude; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + +} diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java new file mode 100644 index 0000000000..0a292ab1e9 --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java @@ -0,0 +1,29 @@ +package com.baeldung.spring.service; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; + +import com.baeldung.spring.form.GeoIP; +import com.maxmind.geoip2.DatabaseReader; +import com.maxmind.geoip2.exception.GeoIp2Exception; +import com.maxmind.geoip2.model.CityResponse; + +public class RawDBDemoGeoIPLocationService{ + private DatabaseReader dbReader; + + public RawDBDemoGeoIPLocationService() throws IOException { + File database = new File("C:\\Users\\Parth Joshi\\Desktop\\GeoLite2-City.mmdb\\GeoLite2-City.mmdb"); + dbReader = new DatabaseReader.Builder(database).build(); + } + + public GeoIP getLocation(String ip) throws IOException, GeoIp2Exception { + InetAddress ipAddress = InetAddress.getByName(ip); + CityResponse response = dbReader.city(ipAddress); + + String cityName = response.getCity().getName(); + String latitude = response.getLocation().getLatitude().toString(); + String longitude = response.getLocation().getLongitude().toString(); + return new GeoIP(ip, cityName, latitude, longitude); + } +} diff --git a/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp b/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp new file mode 100644 index 0000000000..431f6162bc --- /dev/null +++ b/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp @@ -0,0 +1,84 @@ + + + + +Geo IP Test + + + + + + + + +
+ + + +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java b/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java new file mode 100644 index 0000000000..72d528095e --- /dev/null +++ b/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java @@ -0,0 +1,31 @@ +package com.baeldung.geoip; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; + +import org.junit.Test; + +import com.maxmind.geoip2.DatabaseReader; +import com.maxmind.geoip2.exception.GeoIp2Exception; +import com.maxmind.geoip2.model.CityResponse; + + +public class GeoIpIntegrationTest { + + @Test + public void givenIP_whenFetchingCity_thenReturnsCityData() throws IOException, GeoIp2Exception { + File database = new File("C:\\Users\\Parth Joshi\\Desktop\\GeoLite2-City.mmdb\\GeoLite2-City.mmdb"); + DatabaseReader dbReader = new DatabaseReader.Builder(database).build(); + + InetAddress ipAddress = InetAddress.getByName("202.47.112.9"); + CityResponse response = dbReader.city(ipAddress); + + String countryName = response.getCountry().getName(); + String cityName = response.getCity().getName(); + String postal = response.getPostal().getCode(); + String state = response.getLeastSpecificSubdivision().getName(); + + } + +} diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index 6580f5ecc7..3c23f1bca7 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 com.baeldung spring-rest @@ -9,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.4.2.RELEASE @@ -24,6 +25,10 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.boot + spring-boot-devtools + @@ -49,7 +54,7 @@ commons-fileupload commons-fileupload - 1.3.1 + 1.3.2 @@ -73,9 +78,9 @@ - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + com.thoughtworks.xstream @@ -94,7 +99,7 @@ org.apache.commons commons-lang3 - 3.2.1 + 3.5 @@ -157,16 +162,21 @@ - com.jayway.restassured - rest-assured - ${rest-assured.version} - + com.jayway.restassured + rest-assured + ${rest-assured.version} + - + com.google.protobuf protobuf-java - 2.6.1 + 3.1.0 + + + com.googlecode.protobuf-java-format + protobuf-java-format + 1.4 @@ -206,7 +216,8 @@ maven-surefire-plugin - **/*LiveTest.java + **/*IntegrationTest.java + **/*LiveTest.java @@ -240,6 +251,36 @@
+ + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*IntegrationTest.java + + + + + + + + + + live @@ -292,6 +333,7 @@ + @@ -299,13 +341,13 @@ 4.3.11.Final - 5.1.39 + 5.1.40 5.2.2.Final - 19.0 + 20.0 3.4 @@ -323,7 +365,7 @@ 1.1.3 - 3.5.1 + 3.6.0 2.6 2.19.1 1.6.0 @@ -332,7 +374,8 @@ 3.4.1 - + + org.codehaus.mojo @@ -345,4 +388,5 @@ + diff --git a/spring-security-rest-full/src/main/java/org/baeldung/example/spring/AnotherBootApp.java b/spring-rest/src/main/java/org/baeldung/config/Application.java similarity index 61% rename from spring-security-rest-full/src/main/java/org/baeldung/example/spring/AnotherBootApp.java rename to spring-rest/src/main/java/org/baeldung/config/Application.java index 445a70f29c..077213b04d 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/example/spring/AnotherBootApp.java +++ b/spring-rest/src/main/java/org/baeldung/config/Application.java @@ -1,17 +1,16 @@ -package org.baeldung.example.spring; +package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; -import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -@EnableScheduling @EnableAutoConfiguration @ComponentScan("org.baeldung") -public class AnotherBootApp extends WebMvcConfigurerAdapter { +public class Application extends WebMvcConfigurerAdapter { public static void main(final String[] args) { - SpringApplication.run(AnotherBootApp.class, args); + SpringApplication.run(Application.class, args); } + } \ No newline at end of file diff --git a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java index d116148f09..39c1252c4f 100644 --- a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java +++ b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java @@ -17,9 +17,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter /* * Please note that main web configuration is in src/main/webapp/WEB-INF/api-servlet.xml - * */ - @Configuration @EnableWebMvc @ComponentScan({ "org.baeldung.web" }) @@ -33,13 +31,14 @@ public class WebConfig extends WebMvcConfigurerAdapter { @Override public void configureMessageConverters(final List> messageConverters) { - messageConverters.add(createXmlHttpMessageConverter()); - // messageConverters.add(new MappingJackson2HttpMessageConverter()); - final Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); builder.indentOutput(true).dateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm")); messageConverters.add(new MappingJackson2HttpMessageConverter(builder.build())); // messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.createXmlMapper(true).build())); + + // messageConverters.add(createXmlHttpMessageConverter()); + // messageConverters.add(new MappingJackson2HttpMessageConverter()); + messageConverters.add(new ProtobufHttpMessageConverter()); messageConverters.add(new KryoHttpMessageConverter()); super.configureMessageConverters(messageConverters); diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest/src/main/java/org/baeldung/web/controller/FooController.java index dd1e3ca222..21ba3c6d13 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-rest/src/main/java/org/baeldung/web/controller/FooController.java @@ -1,7 +1,6 @@ package org.baeldung.web.controller; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; import org.baeldung.web.dto.Foo; import org.baeldung.web.dto.FooProtos; @@ -26,7 +25,7 @@ public class FooController { @RequestMapping(method = RequestMethod.GET, value = "/foos/{id}") @ResponseBody public Foo findById(@PathVariable final long id) { - return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); + return new Foo(id, randomAlphabetic(4)); } // API - write diff --git a/spring-rest/src/main/resources/application.properties b/spring-rest/src/main/resources/application.properties new file mode 100644 index 0000000000..300589f561 --- /dev/null +++ b/spring-rest/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.port= 8082 +server.context-path=/spring-rest \ No newline at end of file diff --git a/spring-rest/src/test/java/org/baeldung/client/Consts.java b/spring-rest/src/test/java/org/baeldung/client/Consts.java new file mode 100644 index 0000000000..b40561d9c3 --- /dev/null +++ b/spring-rest/src/test/java/org/baeldung/client/Consts.java @@ -0,0 +1,5 @@ +package org.baeldung.client; + +public interface Consts { + int APPLICATION_PORT = 8082; +} diff --git a/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java b/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java new file mode 100644 index 0000000000..e4321e163f --- /dev/null +++ b/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java @@ -0,0 +1,59 @@ +package org.baeldung.client; + +import static org.baeldung.client.Consts.APPLICATION_PORT; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Matchers.notNull; + +import java.io.IOException; + +import org.baeldung.web.dto.Foo; +import org.junit.Before; +import org.junit.Test; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class RestTemplateBasicLiveTest { + + private RestTemplate restTemplate; + private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-rest/foos"; + + @Before + public void beforeTest() { + restTemplate = new RestTemplate(); + } + + // GET + + @Test + public void givenResourceUrl_whenSendGetForRequestEntity_thenStatusOk() throws IOException { + ResponseEntity response = restTemplate.getForEntity(fooResourceUrl + "/1", String.class); + + assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); + } + + @Test + public void givenResourceUrl_whenSendGetForRequestEntity_thenBodyCorrect() throws IOException { + ResponseEntity response = restTemplate.getForEntity(fooResourceUrl + "/1", String.class); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode root = mapper.readTree(response.getBody()); + JsonNode name = root.path("name"); + assertThat(name.asText(), is(notNull())); + } + + @Test + public void givenResourceUrl_whenRetrievingResource_thenCorrect() throws IOException { + final Foo foo = restTemplate.getForObject(fooResourceUrl + "/1", Foo.class); + + assertThat(foo.getName(), notNullValue()); + assertThat(foo.getId(), is(1L)); + } + +} diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java similarity index 78% rename from spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerTest.java rename to spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java index cafaff7b07..b31bfcf5ec 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerTest.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/redirect/RedirectControllerIntegrationTest.java @@ -1,6 +1,6 @@ package org.baeldung.web.controller.redirect; -import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.flash; @@ -24,7 +24,7 @@ import org.springframework.web.context.WebApplicationContext; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("file:src/main/webapp/WEB-INF/api-servlet.xml") @WebAppConfiguration -public class RedirectControllerTest { +public class RedirectControllerIntegrationTest { private MockMvc mockMvc; @@ -38,30 +38,30 @@ public class RedirectControllerTest { @Test public void whenRedirectOnUrlWithUsingXMLConfig_thenStatusRedirectionAndRedirectedOnUrl() throws Exception { - mockMvc.perform(get("/redirectWithXMLConfig")).andExpect(status().is3xxRedirection()).andExpect(view().name("RedirectedUrl")).andExpect(model().attribute("attribute", is("redirectWithXMLConfig"))) + mockMvc.perform(get("/redirectWithXMLConfig")).andExpect(status().is3xxRedirection()).andExpect(view().name("RedirectedUrl")).andExpect(model().attribute("attribute", equalTo("redirectWithXMLConfig"))) .andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithXMLConfig")); } @Test public void whenRedirectOnUrlWithUsingRedirectPrefix_thenStatusRedirectionAndRedirectedOnUrl() throws Exception { - mockMvc.perform(get("/redirectWithRedirectPrefix")).andExpect(status().is3xxRedirection()).andExpect(view().name("redirect:/redirectedUrl")).andExpect(model().attribute("attribute", is("redirectWithRedirectPrefix"))) + mockMvc.perform(get("/redirectWithRedirectPrefix")).andExpect(status().is3xxRedirection()).andExpect(view().name("redirect:/redirectedUrl")).andExpect(model().attribute("attribute", equalTo("redirectWithRedirectPrefix"))) .andExpect(redirectedUrl("/redirectedUrl?attribute=redirectWithRedirectPrefix")); } @Test public void whenRedirectOnUrlWithUsingRedirectAttributes_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope() throws Exception { - mockMvc.perform(get("/redirectWithRedirectAttributes")).andExpect(status().is3xxRedirection()).andExpect(flash().attribute("flashAttribute", is("redirectWithRedirectAttributes"))) - .andExpect(model().attribute("attribute", is("redirectWithRedirectAttributes"))).andExpect(model().attribute("flashAttribute", is(nullValue()))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectAttributes")); + mockMvc.perform(get("/redirectWithRedirectAttributes")).andExpect(status().is3xxRedirection()).andExpect(flash().attribute("flashAttribute", equalTo("redirectWithRedirectAttributes"))) + .andExpect(model().attribute("attribute", equalTo("redirectWithRedirectAttributes"))).andExpect(model().attribute("flashAttribute", equalTo(nullValue()))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectAttributes")); } @Test public void whenRedirectOnUrlWithUsingRedirectView_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope() throws Exception { - mockMvc.perform(get("/redirectWithRedirectView")).andExpect(status().is3xxRedirection()).andExpect(model().attribute("attribute", is("redirectWithRedirectView"))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectView")); + mockMvc.perform(get("/redirectWithRedirectView")).andExpect(status().is3xxRedirection()).andExpect(model().attribute("attribute", equalTo("redirectWithRedirectView"))).andExpect(redirectedUrl("redirectedUrl?attribute=redirectWithRedirectView")); } @Test public void whenRedirectOnUrlWithUsingForwardPrefix_thenStatusOkAndForwardedOnUrl() throws Exception { - mockMvc.perform(get("/forwardWithForwardPrefix")).andExpect(status().isOk()).andExpect(view().name("forward:/redirectedUrl")).andExpect(model().attribute("attribute", is("redirectWithForwardPrefix"))).andExpect(forwardedUrl("/redirectedUrl")); + mockMvc.perform(get("/forwardWithForwardPrefix")).andExpect(status().isOk()).andExpect(view().name("forward:/redirectedUrl")).andExpect(model().attribute("attribute", equalTo("redirectWithForwardPrefix"))).andExpect(forwardedUrl("/redirectedUrl")); } } diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerIntegrationTest.java similarity index 96% rename from spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java rename to spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerIntegrationTest.java index c50e1b4f43..e29bef501e 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerIntegrationTest.java @@ -18,7 +18,7 @@ import org.springframework.web.context.WebApplicationContext; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = WebConfig.class) @WebAppConfiguration -public class ExampleControllerTest { +public class ExampleControllerIntegrationTest { private MockMvc mockMvc; diff --git a/spring-security-rest-full/.springBeans b/spring-security-rest-full/.springBeans new file mode 100644 index 0000000000..f100c6afbe --- /dev/null +++ b/spring-security-rest-full/.springBeans @@ -0,0 +1,19 @@ + + + 1 + + + + + + + java:org.baeldung.security.spring.SecurityWithoutCsrfConfig + + + src/main/webapp/WEB-INF/api-servlet.xml + java:org.baeldung.spring.Application + java:org.baeldung.security.spring.SecurityWithCsrfConfig + + + + diff --git a/spring-security-rest-full/pom.xml b/spring-security-rest-full/pom.xml index 957a349d3c..ab354d51a7 100644 --- a/spring-security-rest-full/pom.xml +++ b/spring-security-rest-full/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.8.RELEASE + 1.4.2.RELEASE @@ -109,14 +109,12 @@ - com.mysema.querydsl + com.querydsl querydsl-apt - ${querydsl.version} - com.mysema.querydsl + com.querydsl querydsl-jpa - ${querydsl.version} @@ -161,7 +159,6 @@ xml-apis xml-apis - ${xml-apis.version} org.javassist @@ -358,7 +355,7 @@ target/generated-sources/java - com.mysema.query.apt.jpa.JPAAnnotationProcessor + com.querydsl.apt.jpa.JPAAnnotationProcessor @@ -467,16 +464,13 @@ - 4.2.5.RELEASE - 4.0.4.RELEASE 4.3.11.Final - 5.1.38 - 1.8.2.RELEASE + 5.1.40 2.0.0 - 3.6.2 + 4.1.4 2.7.8 @@ -505,7 +499,7 @@ 2.9.0 - 3.5.1 + 3.6.0 2.6 2.19.1 1.4.18 diff --git a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java index 7a00e7490c..63ae35ec1f 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java @@ -3,10 +3,10 @@ package org.baeldung.persistence.dao; import org.baeldung.persistence.model.MyUser; import org.baeldung.web.util.SearchCriteria; -import com.mysema.query.types.expr.BooleanExpression; -import com.mysema.query.types.path.NumberPath; -import com.mysema.query.types.path.PathBuilder; -import com.mysema.query.types.path.StringPath; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.NumberPath; +import com.querydsl.core.types.dsl.PathBuilder; +import com.querydsl.core.types.dsl.StringPath; public class MyUserPredicate { diff --git a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java index 5e08bde273..caee59c1ec 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java @@ -5,7 +5,7 @@ import java.util.List; import org.baeldung.web.util.SearchCriteria; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.dsl.BooleanExpression; public final class MyUserPredicatesBuilder { private final List params; diff --git a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java index db3627817a..029b57016b 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java @@ -7,7 +7,7 @@ import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer; import org.springframework.data.querydsl.binding.QuerydslBindings; -import com.mysema.query.types.path.StringPath; +import com.querydsl.core.types.dsl.StringPath; public interface MyUserRepository extends JpaRepository, QueryDslPredicateExecutor, QuerydslBinderCustomizer { @Override diff --git a/spring-security-rest-full/src/main/java/org/baeldung/spring/SecurityWithoutCsrfConfig.java b/spring-security-rest-full/src/main/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java similarity index 98% rename from spring-security-rest-full/src/main/java/org/baeldung/spring/SecurityWithoutCsrfConfig.java rename to spring-security-rest-full/src/main/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java index aeb2428326..f1a78d1472 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/spring/SecurityWithoutCsrfConfig.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package org.baeldung.security.spring; import org.baeldung.web.error.CustomAccessDeniedHandler; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/controller/UserController.java b/spring-security-rest-full/src/main/java/org/baeldung/web/controller/UserController.java index cf46e35e57..d20423ddc0 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/web/controller/UserController.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/web/controller/UserController.java @@ -29,8 +29,8 @@ import org.springframework.web.bind.annotation.ResponseStatus; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; -import com.mysema.query.types.Predicate; -import com.mysema.query.types.expr.BooleanExpression; +import com.querydsl.core.types.Predicate; +import com.querydsl.core.types.dsl.BooleanExpression; import cz.jirutka.rsql.parser.RSQLParser; import cz.jirutka.rsql.parser.ast.Node; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java index 63efd870cd..e06461fc2c 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java @@ -4,8 +4,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.baeldung.security.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.WebConfig; import org.junit.Test; import org.springframework.http.MediaType; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java index b04644f847..939b745de8 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java @@ -4,6 +4,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.baeldung.security.spring.SecurityWithCsrfConfig; import org.baeldung.spring.PersistenceConfig; import org.baeldung.spring.WebConfig; import org.junit.Test; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java b/spring-security-rest-full/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java similarity index 98% rename from spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java rename to spring-security-rest-full/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java index ae4a655265..97ae1f1dd2 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/SecurityWithCsrfConfig.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.security.csrf; +package org.baeldung.security.spring; import org.baeldung.web.error.CustomAccessDeniedHandler; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java index 99b391eda1..7dcaec5a12 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java @@ -3,8 +3,8 @@ package org.baeldung.web.interceptor; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.baeldung.security.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.WebConfig; import org.junit.Before; import org.junit.Test; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java index 662fc997f9..d62fab0670 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java @@ -5,8 +5,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import javax.servlet.http.HttpSession; +import org.baeldung.security.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.WebConfig; import org.junit.Before; import org.junit.Test; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java index 0e8f7c98ed..f995f86145 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java @@ -1,7 +1,7 @@ package org.baeldung.web.interceptor; +import org.baeldung.security.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityWithoutCsrfConfig; import org.baeldung.spring.WebConfig; import org.junit.Before; import org.junit.Test;