Skip to content

Commit 36514bb

Browse files
committed
Fixed major bom issue
1 parent 7b901b6 commit 36514bb

File tree

7 files changed

+156
-6
lines changed

7 files changed

+156
-6
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<version>1.0-SNAPSHOT</version>
1212

1313
<modules>
14-
<module>spring-tutorial-bom</module>
14+
<module>spring-tutorial-boms</module>
1515
<module>spring-core-ioc</module>
1616
<module>spring-core-beanlifecycle</module>
1717
<module>spring-core-beanpostprocessor</module>
@@ -28,6 +28,7 @@
2828
<module>spring-aop-08-advice-parameters</module>
2929
<module>spring-aop-09-custom-annotation</module>
3030
<module>spring-aop-10-inter-type-declarations</module>
31+
<module>spring-core-null-safety</module>
3132
</modules>
3233

3334
<properties>

spring-core-null-safety/pom.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>spring-framework-tutorial-parent</artifactId>
7+
<groupId>com.jstobigdata</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>spring-core-null-safety</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.springframework</groupId>
17+
<artifactId>spring-core</artifactId>
18+
</dependency>
19+
20+
<dependency>
21+
<groupId>org.springframework</groupId>
22+
<artifactId>spring-context</artifactId>
23+
</dependency>
24+
25+
<!-- Test Dependencies-->
26+
<dependency>
27+
<groupId>org.junit.jupiter</groupId>
28+
<artifactId>junit-jupiter-api</artifactId>
29+
<scope>test</scope>
30+
</dependency>
31+
32+
<dependency>
33+
<groupId>org.junit.jupiter</groupId>
34+
<artifactId>junit-jupiter-engine</artifactId>
35+
<scope>test</scope>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework</groupId>
40+
<artifactId>spring-test</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
</dependencies>
44+
45+
<dependencyManagement>
46+
<dependencies>
47+
<dependency>
48+
<groupId>com.jstobigdata</groupId>
49+
<artifactId>spring-tutorial-boms</artifactId>
50+
<type>pom</type>
51+
<scope>import</scope>
52+
<version>1.0-SNAPSHOT</version>
53+
</dependency>
54+
</dependencies>
55+
</dependencyManagement>
56+
57+
<!-- For Junit-jupiter, upgrade the maven surefire -->
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-surefire-plugin</artifactId>
63+
<version>3.0.0-M3</version>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
</project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.jbd.spring;
2+
3+
import com.jbd.spring.fieldlevel.Person;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.ComponentScan;
6+
import org.springframework.context.annotation.Configuration;
7+
8+
@Configuration
9+
@ComponentScan("com.jbd.spring.nullsafety")
10+
public class AppConfig {
11+
@Bean
12+
public Person person(){
13+
return new Person(100L, null,null);
14+
}
15+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.jbd.spring.fieldlevel;
2+
3+
import org.springframework.lang.NonNull;
4+
import org.springframework.lang.Nullable;
5+
6+
public class Person {
7+
@NonNull
8+
private Long id;
9+
@NonNull
10+
private String name;
11+
@Nullable
12+
private String email;
13+
14+
public Person(@NonNull Long id, @NonNull String name, @Nullable String email) {
15+
this.id = id;
16+
this.name = name;
17+
this.email = email;
18+
}
19+
20+
@NonNull
21+
public Long getId() {
22+
return id;
23+
}
24+
25+
public Person setId(@NonNull Long id) {
26+
this.id = id;
27+
return this;
28+
}
29+
30+
@NonNull
31+
public String getName() {
32+
return name;
33+
}
34+
35+
public Person setName(@NonNull String name) {
36+
this.name = name;
37+
return this;
38+
}
39+
40+
@Nullable
41+
public String getEmail() {
42+
return email;
43+
}
44+
45+
public Person setEmail(@Nullable String email) {
46+
this.email = email;
47+
return this;
48+
}
49+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.jbd.spring;
2+
3+
import com.jbd.spring.fieldlevel.Person;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
7+
8+
@SpringJUnitConfig(AppConfig.class)
9+
public class TestNullSafety {
10+
11+
@Autowired
12+
private Person person;
13+
14+
@Test
15+
public void testNullSafety(){
16+
System.out.println(person.toString());
17+
}
18+
}

spring-mvc-00-getting-started/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<dependencies>
4343
<dependency>
4444
<groupId>com.jstobigdata</groupId>
45-
<artifactId>spring-tutorial-bom</artifactId>
45+
<artifactId>spring-tutorial-boms</artifactId>
4646
<version>1.0-SNAPSHOT</version>
4747
<scope>import</scope>
4848
<type>pom</type>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<packaging>pom</packaging>
12-
<artifactId>spring-tutorial-bom</artifactId>
12+
<artifactId>spring-tutorial-boms</artifactId>
1313

1414
<name>Spring Framework Tutorial Bill of Materials</name>
1515
<description>Bill of materials for entire Spring-Framework Tutorials</description>
@@ -21,9 +21,9 @@
2121

2222
<properties>
2323
<!-- JDK Version -->
24-
<maven.compiler.target>1.8</maven.compiler.target>
25-
<maven.compiler.source>1.8</maven.compiler.source>
26-
<java.version>1.8</java.version>
24+
<maven.compiler.target>11</maven.compiler.target>
25+
<maven.compiler.source>11</maven.compiler.source>
26+
<java.version>11</java.version>
2727

2828
<!-- Spring.boot version -->
2929
<spring.boot.version>2.2.2.RELEASE</spring.boot.version>

0 commit comments

Comments
 (0)