Skip to content

Commit c79f53d

Browse files
authored
Merge pull request oskariorg#1136 from ArttuPietarinen/migration-quide-spring-update
minor migration guide documention on spring 6
2 parents c76bffe + d437ab7 commit c79f53d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

MigrationGuide.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ Some application specific files might have imports from javax.servlet. You can s
1212
git grep -l javax.servlet. | xargs sed -i "s/import javax.servlet./import jakarta.servlet./g"
1313
```
1414

15-
TODO: add some guidance for Spring changes?
15+
### Spring configuration
16+
- Dependency updates
17+
- javax.servlet:javax.servlet-api -> jakarta.servlet:jakarta.servlet-api
18+
- JSP functionality requires jakarta.servlet.jsp.jst and jakarta.servlet.jsp.jstl-api
19+
- https://github.com/oskariorg/sample-server-extension/blob/9f0aeafbb037b7f61446b1049dad2aa3248bd21c/webapp-map/pom.xml#L103-L110
20+
21+
Spring 6 security configuration have to changed to bean based classes from extending WebSecurityConfigurerAdapter etc.
22+
23+
Security configurations should have @Profile() and @Order() annotation to work properly.
24+
25+
User class doesn't handle attribute serialization anymore so it must be done on calling end:
26+
- user.getAttributesJSON() -> new JSONObject(user.getAttributes())
1627

1728
### User management
1829

@@ -31,13 +42,16 @@ git grep -l fi.nls.oskari.spring. | xargs sed -i "s/import fi.nls.oskari.spring.
3142
```
3243

3344
### Junit migrated from 4 to 5
34-
3545
The Junit present on the BOM for oskari-server was updated from JUnit 4 to 5 and JUnit changed the groupId and artifactId in their update. This means that if your app does NOT define a specific version for the JUnit dependency and depend on oskari-server doing it, your app will not compile after updating due to missing dependency version. To fix this you have some options and here's what we've used:
3646

3747
- for the sample-server-extension there were no tests so junit was removed from dependencies: https://github.com/oskariorg/sample-server-extension/pull/63
3848
- for apps that do have tests and don't want to migrate them, you can define the junit 4 dependency version for the app like this: https://github.com/nls-oskari/kartta.paikkatietoikkuna.fi/pull/235
3949
- for apps that want to migrate to JUnit 5, you can do something like this: https://github.com/nlsfi/oskari-server-extras/pull/31
40-
50+
- Changed annotations
51+
- @Before -> @BeforeEach
52+
- @After -> @AfterEach
53+
- @Ignore -> @Disabled()
54+
- Tests may require @TestInstance(TestInstance.Lifecycle.PER_CLASS) annotation after update
4155
### Generic proxy removed
4256

4357
A proxy implementation was previously used to pass requests from

0 commit comments

Comments
 (0)