Skip to content

Commit

Permalink
Spring Boot batch and session rules
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Manuel Leflet Estrada <jleflete@redhat.com>
  • Loading branch information
jmle committed Feb 10, 2025
1 parent 6d04bb8 commit 268526f
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 0 deletions.
64 changes: 64 additions & 0 deletions default/generated/spring-boot/spring-boot-2.x-to-3.0-batch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
- ruleID: spring-boot-2.x-to-3.0-batch-00000
category: optional
effort: 1
labels:
- konveyor.io/source=spring-boot2
- konveyor.io/target=spring-boot3+
when:
java.referenced:
pattern: org.springframework.batch.core.configuration.annotation.EnableBatchProcessing
location: ANNOTATION
description: "@EnableBatchProcessing not needed anymore"
message: |
Previously, `@EnableBatchProcessing` could be used to enable Spring Boot’s auto-configuration of Spring Batch. It is
no longer required and should be removed from applications that want to use Boot’s auto-configuration. A bean that
is annotated with `@EnableBatchProcessing` or that extends Batch’s `DefaultBatchConfiguration` can now be defined to
tell the auto-configuration to back off, allowing the application to take complete control of how Batch is configured.
links:
- title: 'Spring Boot 3.0 Migration Guide - Spring Batch'
url: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#enablebatchprocessing-is-now-discouraged

- ruleID: spring-boot-2.x-to-3.0-batch-00010
category: potential
effort: 3
labels:
- konveyor.io/source=spring-boot2
- konveyor.io/target=spring-boot3+
when:
java.dependency:
name: org.springframework.batch.spring-batch-core
lowerbound: 0.0.0
description: Running multiple batch jobs is no longer supported
message: |
Running multiple batch jobs is no longer supported. If the auto-configuration detects a single job is, it will be
executed on startup. If multiple jobs are found in the context, a job name to execute on startup must be supplied
by the user using the `spring.batch.job.name` property.
links:
- title: 'Spring Boot 3.0 Migration Guide - Spring Batch'
url: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#multiple-batch-jobs


- ruleID: spring-boot-2.x-to-3.0-batch-00020
category: mandatory
effort: 1
labels:
- konveyor.io/source=spring-boot2
- konveyor.io/target=spring-boot3+
when:
builtin.filecontent:
pattern: spring\.session\.store-type
filePattern: .*\.properties
description: Store type explicit config no longer supported
message: |
Explicitly configuring the store type for Spring session via `spring.session.store-type` is no longer supported.
In case multiple session store repository implementations are detected on the classpath, a fixed order is used to
determine which SessionRepository should be auto-configured. If Spring Boot’s defined ordering doesn’t meet your
needs, you can define your own `SessionRepository` bean and cause the auto-configuration to back off.
links:
- title: 'Spring Boot 3.0 Migration Guide - Spring batch'
link: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#spring-session-store-type
- title: "Spring documentation - Spring session"
link: https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/web.html#web.spring-session
22 changes: 22 additions & 0 deletions default/generated/spring-boot/spring-boot-2.x-to-3.0-session.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- ruleID: spring-boot-2.x-to-3.0-session-00000
category: mandatory
effort: 1
labels:
- konveyor.io/source=spring-boot2
- konveyor.io/target=spring-boot3+
when:
builtin.filecontent:
pattern: spring\.session\.store-type
filePattern: .*\.properties
description: Store type explicit config no longer supported
message: |
Explicitly configuring the store type for Spring session via `spring.session.store-type` is no longer supported.
In case multiple session store repository implementations are detected on the classpath, a fixed order is used to
determine which SessionRepository should be auto-configured. If Spring Boot’s defined ordering doesn’t meet your
needs, you can define your own `SessionRepository` bean and cause the auto-configuration to back off.
links:
- title: 'Spring Boot 3.0 Migration Guide - Spring batch'
link: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#spring-session-store-type
- title: "Spring documentation - Spring session"
link: https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/web.html#web.spring-session
6 changes: 6 additions & 0 deletions default/generated/spring-boot/tests/data/core-changes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>


<!-- Spring Boot Starter Data JPA for database access -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.konveyor.core;

import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand All @@ -9,6 +10,7 @@
import org.springframework.security.authentication.AuthenticationManagerResolver;

@Configuration
@EnableBatchProcessing
@EnableConfigurationProperties(ApplicationProperties.class)
public class Config {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ spring.application.name=boot-deps
server.max-http-header-size=1024
spring.data.a-property=hey
spring.security.saml2.relyingparty.registration.heythere.identity-provider=provider
spring.session.store-type=Storetype
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
rulesPath: ../spring-boot-2.x-to-3.0-batch.yaml
providers:
- name: java
dataPath: ./data/core-changes
- name: builtin
dataPath: ./data/core-changes
tests:
- ruleID: spring-boot-2.x-to-3.0-batch-00000
testCases:
- name: tc-1
analysisParams:
mode: "source-only"
hasIncidents:
exactly: 1
- ruleID: spring-boot-2.x-to-3.0-batch-00010
testCases:
- name: tc-1
analysisParams:
mode: "source-only"
hasIncidents:
exactly: 1
- ruleID: spring-boot-2.x-to-3.0-batch-00020
testCases:
- name: tc-1
analysisParams:
mode: "source-only"
hasIncidents:
exactly: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
rulesPath: ../spring-boot-2.x-to-3.0-session.yaml
providers:
- name: java
dataPath: ./data/core-changes
- name: builtin
dataPath: ./data/core-changes
tests:
- ruleID: spring-boot-2.x-to-3.0-session-00000
testCases:
- name: tc-1
analysisParams:
mode: "source-only"
hasIncidents:
exactly: 1

0 comments on commit 268526f

Please sign in to comment.