Skip to content

Commit d5dcdf3

Browse files
authored
[JAVA-39453] Upgraded spring-static-resources from spring-5 to spring-6 (#17579)
* [JAVA-39453] Upgraded spring-static-resources from spring-5 to spring-6 * [JAVA-39453] Clean up
1 parent 503d0e1 commit d5dcdf3

File tree

6 files changed

+23
-27
lines changed

6 files changed

+23
-27
lines changed

spring-static-resources/pom.xml

+13-14
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
<parent>
1212
<groupId>com.baeldung</groupId>
13-
<artifactId>parent-spring-5</artifactId>
13+
<artifactId>parent-spring-6</artifactId>
1414
<version>0.0.1-SNAPSHOT</version>
15-
<relativePath>../parent-spring-5</relativePath>
15+
<relativePath>../parent-spring-6</relativePath>
1616
</parent>
1717

1818
<dependencies>
@@ -95,21 +95,17 @@
9595
<artifactId>javax.inject</artifactId>
9696
<version>${inject.version}</version>
9797
</dependency>
98-
<!-- Servlet -->
9998
<dependency>
100-
<groupId>javax.servlet</groupId>
101-
<artifactId>javax.servlet-api</artifactId>
102-
<version>${javax.servlet-api.version}</version>
99+
<groupId>jakarta.servlet</groupId>
100+
<artifactId>jakarta.servlet-api</artifactId>
101+
<version>${jakarta.servlet-api.version}</version>
102+
<scope>provided</scope>
103103
</dependency>
104104
<dependency>
105-
<groupId>javax.servlet.jsp</groupId>
106-
<artifactId>javax.servlet.jsp-api</artifactId>
107-
<version>${javax.servlet.jsp-api.version}</version>
108-
</dependency>
109-
<dependency>
110-
<groupId>javax.servlet</groupId>
111-
<artifactId>jstl</artifactId>
112-
<version>${jstl.version}</version>
105+
<groupId>jakarta.servlet.jsp.jstl</groupId>
106+
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
107+
<version>${jakarta.jstl-api.version}</version>
108+
<scope>runtime</scope>
113109
</dependency>
114110
<dependency>
115111
<groupId>com.fasterxml.jackson.core</groupId>
@@ -194,6 +190,9 @@
194190
</build>
195191

196192
<properties>
193+
<spring-security.version>6.3.3</spring-security.version>
194+
<jakarta.jstl-api.version>3.0.2</jakarta.jstl-api.version>
195+
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
197196
<aspectj.version>1.9.20.1</aspectj.version>
198197
<!-- various 1.3.2 -->
199198
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>

spring-static-resources/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.baeldung.security;
22

33
import java.io.IOException;
4-
import javax.servlet.http.HttpServletRequest;
5-
import javax.servlet.http.HttpServletResponse;
6-
import javax.servlet.http.HttpSession;
4+
5+
import jakarta.servlet.http.HttpServletRequest;
6+
import jakarta.servlet.http.HttpServletResponse;
7+
import jakarta.servlet.http.HttpSession;
78
import org.slf4j.Logger;
89
import org.slf4j.LoggerFactory;
910
import org.springframework.security.core.Authentication;
@@ -17,6 +18,7 @@ public class MySimpleUrlAuthenticationSuccessHandler implements AuthenticationSu
1718

1819
private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
1920

21+
@Override
2022
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
2123
handle(request, response, authentication);
2224
HttpSession session = request.getSession(false);

spring-static-resources/src/main/java/com/baeldung/spring/MvcConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
@ComponentScan(basePackages = { "com.baeldung.web.controller", "com.baeldung.persistence.service", "com.baeldung.persistence.dao" })
2929
@EnableWebMvc
3030
public class MvcConfig implements WebMvcConfigurer {
31+
3132
@Autowired
3233
Environment env;
3334

spring-static-resources/src/main/java/com/baeldung/spring/SecSecurityConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.baeldung.spring;
22

33
import org.springframework.context.annotation.Configuration;
4-
import org.springframework.context.annotation.ImportResource;
4+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
55

66
@Configuration
7-
@ImportResource({ "classpath:webSecurityConfig.xml" })
7+
@EnableWebMvc
88
public class SecSecurityConfig {
99

1010
public SecSecurityConfig() {

spring-static-resources/src/test/java/com/baeldung/SpringContextTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
import org.junit.runner.RunWith;
66
import org.springframework.test.context.ContextConfiguration;
77
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
8-
import org.springframework.test.context.support.AnnotationConfigContextLoader;
98
import org.springframework.test.context.web.WebAppConfiguration;
109

1110
@RunWith(SpringJUnit4ClassRunner.class)
12-
@ContextConfiguration(classes = { SecSecurityConfig.class }, loader = AnnotationConfigContextLoader.class)
11+
@ContextConfiguration(classes = { SecSecurityConfig.class})
1312
@WebAppConfiguration
1413
public class SpringContextTest {
1514

spring-static-resources/src/test/java/com/baeldung/loadresourceasstring/LoadResourceAsStringIntegrationTest.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.beans.factory.annotation.Qualifier;
77
import org.springframework.beans.factory.annotation.Value;
8-
import org.springframework.core.convert.converter.Converter;
9-
import org.springframework.core.io.DefaultResourceLoader;
8+
109
import org.springframework.core.io.Resource;
1110
import org.springframework.core.io.ResourceLoader;
1211
import org.springframework.test.context.ContextConfiguration;
1312
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
1413
import org.springframework.test.context.support.AnnotationConfigContextLoader;
15-
import org.springframework.util.FileCopyUtils;
16-
17-
import java.io.InputStreamReader;
1814

19-
import static java.nio.charset.StandardCharsets.UTF_8;
2015
import static org.junit.Assert.assertEquals;
2116

2217
@RunWith(SpringJUnit4ClassRunner.class)

0 commit comments

Comments
 (0)