Getting xstream dependency exception

I solved the ForbiddenClassException without having to revert back to previous versions. I am on spring boot 2.6.2, JDK 11 and Axon 4.5.7

I created class called AxonConfig. The problem with Xstream now that there is the new security update seems to be that you need to specify what will be allowed.

@Configuration
public class AxonConfig {
 
    @Bean
    public XStream xStream() {
        XStream xStream = new XStream();
      
        xStream.allowTypesByWildcard(new String[] {
                "com.appsdeveloperblog.**"
        });
        return xStream;
    }
}

Once I implemented the class above, I went to the @SpringBootApplication classes my microservice a and imported the AxonConfig.class.

@SpringBootApplication
@EnableDiscoveryClient
@Import({ AxonConfig.class })
public class ProductsServiceApplication {
 
   public static void main(String[] args) {
      SpringApplication.run(ProductsServiceApplication.class, args);
   }

Problem solved! works for me without having to revert back.

3 Likes