Really excited to announce that the entire course is now upgraded to Spring Boot 3
- Updated all code for 3.0.0 RELEASE of Spring Boot
- SOAP Web Services
- REST API section is completely re-recorded with Spring Boot 3!
- New Folder - https://github.com/in28minutes/spring-web-services/tree/master/restful-web-services-v2
- (NEW) Step by Step Guide - https://github.com/in28minutes/spring-web-services/blob/master/restful-web-services-v2/01-step-by-step-changes/v2.md
- Complete list of changes - https://github.com/in28minutes/spring-web-services/compare/693a37ce3d710639bc9c788ca6b4468358d76eb8...801c97ecbed252abf083f6f389e4bcf9e3e3ea6f
- Important files that have changed
Use Jakarta EE instead of Java EE
import jakarta.*;
//import javax.*;
Recommended Configuration
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>${project.basedir}/src/main/resources/course-details.xsd</source>
</sources>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
Key changes to note
- Version -
<version>3.1.0</version>
- Source Configuration -
<sources><source>${project.basedir}/src/main/resources/course-details.xsd</source></sources>
- Focus on version
<version>3.1.3</version>
- xws-security and activation dependencies are not needed
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<version>3.1.3</version> <!--Added for Spring Boot 3.0.x-->
<exclusions>
<exclusion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
<dependency>
<groupId>com.sun.xml.wss</groupId>
<artifactId>xws-security</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<groupId>javax.xml.crypto</groupId>
<artifactId>xmldsig</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
-->
Following dependencies are NOT NEEDED!
More details - https://spring.io/blog/2022/12/02/spring-ws-samples-upgraded-for-spring-boot-3-0
NEW CODE FOR Wss4jSecurityInterceptor
// https://spring.io/blog/2022/12/02/spring-ws-samples-upgraded-for-spring-boot-3-0
// XwsSecurity has been deprecated in JakartaEE 9+
//XwsSecurityInterceptor
// @Bean
// public XwsSecurityInterceptor securityInterceptor(){
// XwsSecurityInterceptor securityInterceptor = new XwsSecurityInterceptor();
// //Callback Handler -> SimplePasswordValidationCallbackHandler
// securityInterceptor.setCallbackHandler(callbackHandler());
// //Security Policy -> securityPolicy.xml
// securityInterceptor.setPolicyConfiguration(new ClassPathResource("securityPolicy.xml"));
// return securityInterceptor;
// }
@Bean
public Wss4jSecurityInterceptor securityInterceptor() {
Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor();
securityInterceptor.setSecurementActions("UsernameToken");
securityInterceptor.setSecurementUsername("user");
securityInterceptor.setSecurementPassword("password");
return securityInterceptor;
}
// @Bean
// public SimplePasswordValidationCallbackHandler callbackHandler() {
// SimplePasswordValidationCallbackHandler handler = new SimplePasswordValidationCallbackHandler();
// handler.setUsersMap(Collections.singletonMap("user", "password"));
// return handler;
// }