Skip to content

Commit f45c898

Browse files
vunamtientienvn
and
tienvn
authored
JAVA-39224-Moving-some-article-links-on-spring-core (#17615)
* JAVA-39224-Moving-some-article-links-on-spring-core * JAVA-39224-Moving-some-article-links-on-spring-core * JAVA-39224-Moving-some-article-links-on-spring-core * JAVA-39224-Moving-some-article-links-on-spring-core * JAVA-39224-Moving-some-article-links-on-spring-core --------- Co-authored-by: tienvn <[email protected]>
1 parent 58c0015 commit f45c898

File tree

87 files changed

+181
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+181
-159
lines changed

spring-core-2/README.md

+5-3

spring-core-2/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@
113113
<version>${spring-boot.version}</version>
114114
<scope>test</scope>
115115
</dependency>
116+
<dependency>
117+
<groupId>commons-io</groupId>
118+
<artifactId>commons-io</artifactId>
119+
<version>${commons-io.version}</version>
120+
</dependency>
116121
</dependencies>
117122

118123
<build>
@@ -145,6 +150,7 @@
145150
<javassist.version>3.22.0-GA</javassist.version>
146151
<spring-retry.version>2.0.5</spring-retry.version>
147152
<spring-boot.version>2.2.2.RELEASE</spring-boot.version>
153+
<commons-io.version>2.16.1</commons-io.version>
148154
</properties>
149155

150156
</project>

spring-core/src/main/java/com/baeldung/applicationcontext/Teacher.java spring-core-2/src/main/java/com/baeldung/applicationcontext/Teacher.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package com.baeldung.applicationcontext;
22

3-
import java.util.ArrayList;
4-
import java.util.List;
5-
6-
import jakarta.annotation.PostConstruct;
7-
83
import org.springframework.beans.factory.annotation.Autowired;
94
import org.springframework.context.ApplicationContext;
105

6+
import javax.annotation.PostConstruct;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
1110
public class Teacher {
1211

1312
@Autowired

spring-core/src/main/java/com/baeldung/streamutils/CopyStream.java spring-core-2/src/main/java/com/baeldung/streamutils/CopyStream.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.baeldung.streamutils;
22

3+
import org.apache.commons.io.IOUtils;
4+
import org.springframework.util.StreamUtils;
5+
36
import java.io.FileInputStream;
47
import java.io.IOException;
58
import java.io.InputStream;
69
import java.io.StringWriter;
710

8-
import org.apache.commons.io.IOUtils;
9-
import org.springframework.util.StreamUtils;
10-
1111
public class CopyStream {
1212
public static String getStringFromInputStream(InputStream input) throws IOException {
1313
StringWriter writer = new StringWriter();

spring-core/src/main/java/com/baeldung/streamutils/DrainStream.java spring-core-2/src/main/java/com/baeldung/streamutils/DrainStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.baeldung.streamutils;
22

3-
import java.io.InputStream;
4-
53
import org.springframework.util.StreamUtils;
64

5+
import java.io.InputStream;
6+
77
public class DrainStream {
88
public InputStream getInputStream() {
99
return StreamUtils.emptyInput();

spring-core/src/test/java/com/baeldung/streamutils/CopyStreamIntegrationTest.java spring-core-2/src/test/java/com/baeldung/streamutils/CopyStreamIntegrationTest.java

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
package com.baeldung.streamutils;
22

3-
import static org.junit.Assert.assertTrue;
4-
5-
import java.io.File;
6-
import java.io.FileInputStream;
7-
import java.io.FileOutputStream;
8-
import java.io.IOException;
9-
import java.io.InputStream;
10-
import java.io.OutputStream;
11-
import java.nio.charset.StandardCharsets;
12-
13-
import static org.junit.Assert.assertEquals;
143
import org.junit.Test;
154
import org.springframework.util.StreamUtils;
165

6+
import java.io.*;
7+
import java.nio.charset.StandardCharsets;
8+
179
import static com.baeldung.streamutils.CopyStream.getStringFromInputStream;
10+
import static org.junit.Assert.assertEquals;
11+
import static org.junit.Assert.assertTrue;
1812

1913
public class CopyStreamIntegrationTest {
2014

spring-core-3/README.md

+1-2

spring-core-3/src/main/java/com/baeldung/applicationcontext/AccountRepository.java

-5
This file was deleted.

spring-core/README.md

+6-4

spring-core/pom.xml

+22
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@
5959
<artifactId>jakarta.annotation-api</artifactId>
6060
<version>${jakarta.annotation-api}</version>
6161
</dependency>
62+
<dependency>
63+
<groupId>org.springframework</groupId>
64+
<artifactId>spring-websocket</artifactId>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.springframework</groupId>
68+
<artifactId>spring-tx</artifactId>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.springframework</groupId>
72+
<artifactId>spring-jdbc</artifactId>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.springframework</groupId>
76+
<artifactId>spring-webmvc</artifactId>
77+
</dependency>
78+
<dependency>
79+
<groupId>jakarta.servlet</groupId>
80+
<artifactId>jakarta.servlet-api</artifactId>
81+
<version>6.1.0</version>
82+
<scope>provided</scope>
83+
</dependency>
6284
</dependencies>
6385

6486
<build>

spring-core-2/src/main/java/com/baeldung/scopes/HelloMessageGenerator.java spring-core/src/main/java/com/baeldung/beanscopes/HelloMessageGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.scopes;
1+
package com.baeldung.beanscopes;
22

33
public class HelloMessageGenerator {
44

spring-core-2/src/main/java/com/baeldung/scopes/Person.java spring-core/src/main/java/com/baeldung/beanscopes/Person.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.scopes;
1+
package com.baeldung.beanscopes;
22

33
public class Person {
44
private String name;

spring-core-2/src/main/java/com/baeldung/scopes/ScopesConfig.java spring-core/src/main/java/com/baeldung/beanscopes/ScopesConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.scopes;
1+
package com.baeldung.beanscopes;
22

33
import org.springframework.context.annotation.Bean;
44
import org.springframework.context.annotation.Configuration;

spring-core-2/src/main/java/com/baeldung/scopes/ScopesController.java spring-core/src/main/java/com/baeldung/beanscopes/ScopesController.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
package com.baeldung.scopes;
2-
3-
import javax.annotation.Resource;
1+
package com.baeldung.beanscopes;
42

3+
import jakarta.annotation.Resource;
54
import org.slf4j.Logger;
65
import org.slf4j.LoggerFactory;
7-
86
import org.springframework.stereotype.Controller;
97
import org.springframework.ui.Model;
108
import org.springframework.web.bind.annotation.RequestMapping;
119

10+
1211
@Controller
1312
public class ScopesController {
1413
public static final Logger LOG = LoggerFactory.getLogger(ScopesController.class);

spring-core-2/src/main/java/com/baeldung/applicationcontext/ApplicationContextProvider.java spring-core/src/main/java/com/baeldung/currentapplicationcontext/ApplicationContextProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.springframework.beans.BeansException;
44
import org.springframework.context.ApplicationContext;

spring-core-2/src/main/java/com/baeldung/applicationcontext/ItemService.java spring-core/src/main/java/com/baeldung/currentapplicationcontext/ItemService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.springframework.stereotype.Service;
44

spring-core-2/src/main/java/com/baeldung/applicationcontext/MyBean.java spring-core/src/main/java/com/baeldung/currentapplicationcontext/MyBean.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.springframework.beans.factory.annotation.Autowired;
44
import org.springframework.context.ApplicationContext;

spring-core-3/src/main/java/com/baeldung/spring/patterns/singleton/BookRepository.java spring-core/src/main/java/com/baeldung/spring/patterns/singleton/BookRepository.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.baeldung.spring.patterns.singleton;
22

3-
import java.util.Optional;
4-
53
import org.springframework.stereotype.Repository;
64

5+
import java.util.Optional;
6+
77
@Repository
88
public class BookRepository {
99

spring-core-3/src/main/java/com/baeldung/spring/patterns/template/BookRowMapper.java spring-core/src/main/java/com/baeldung/spring/patterns/template/BookRowMapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.baeldung.spring.patterns.template;
22

3+
import org.springframework.jdbc.core.RowMapper;
4+
35
import java.sql.ResultSet;
46
import java.sql.SQLException;
57

6-
import org.springframework.jdbc.core.RowMapper;
7-
88
public class BookRowMapper implements RowMapper<Book> {
99

1010
@Override

spring-core-3/src/main/java/com/baeldung/applicationcontext/AccountConfig.java spring-core/src/main/java/com/baeldung/springapplicationcontext/AccountConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.springapplicationcontext;
22

33
import org.springframework.context.MessageSource;
44
import org.springframework.context.annotation.Bean;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.baeldung.springapplicationcontext;
2+
3+
public class AccountRepository {
4+
5+
}

spring-core-3/src/main/java/com/baeldung/applicationcontext/AccountService.java spring-core/src/main/java/com/baeldung/springapplicationcontext/AccountService.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.baeldung.applicationcontext;
2-
3-
import java.util.Locale;
1+
package com.baeldung.springapplicationcontext;
42

53
import org.springframework.beans.factory.annotation.Autowired;
64
import org.springframework.context.MessageSource;
75

6+
import java.util.Locale;
7+
88
public class AccountService {
99

1010
@Autowired

spring-core-3/src/main/java/com/baeldung/applicationcontext/MyWebApplicationInitializer.java spring-core/src/main/java/com/baeldung/springapplicationcontext/MyWebApplicationInitializer.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
package com.baeldung.applicationcontext;
2-
3-
import javax.servlet.ServletContext;
4-
import javax.servlet.ServletException;
5-
import javax.servlet.ServletRegistration;
1+
package com.baeldung.springapplicationcontext;
62

3+
import jakarta.servlet.ServletContext;
4+
import jakarta.servlet.ServletException;
5+
import jakarta.servlet.ServletRegistration;
76
import org.springframework.web.WebApplicationInitializer;
87
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
98
import org.springframework.web.servlet.DispatcherServlet;

spring-core-3/src/main/java/com/baeldung/applicationcontext/MyXmlWebApplicationInitializer.java spring-core/src/main/java/com/baeldung/springapplicationcontext/MyXmlWebApplicationInitializer.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package com.baeldung.applicationcontext;
2-
3-
import javax.servlet.ServletContext;
4-
import javax.servlet.ServletException;
5-
import javax.servlet.ServletRegistration;
1+
package com.baeldung.springapplicationcontext;
62

3+
import jakarta.servlet.ServletContext;
4+
import jakarta.servlet.ServletException;
5+
import jakarta.servlet.ServletRegistration;
76
import org.springframework.web.WebApplicationInitializer;
87
import org.springframework.web.context.support.XmlWebApplicationContext;
98
import org.springframework.web.servlet.DispatcherServlet;
109

10+
1111
public class MyXmlWebApplicationInitializer implements WebApplicationInitializer {
1212

1313
public void onStartup(ServletContext container) throws ServletException {

spring-core-3/src/main/java/com/baeldung/applicationcontext/UserService.java spring-core/src/main/java/com/baeldung/springapplicationcontext/UserService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.springapplicationcontext;
22

33
import org.springframework.stereotype.Component;
44

spring-core-2/src/main/java/com/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java spring-core/src/main/java/com/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void handleContextStart(final ContextStartedEvent cse) {
2020
hitContextStartedHandler = true;
2121
}
2222

23-
@EventListener(condition = "#event.success")
23+
@EventListener(condition = "#root.args[0].success")
2424
public void handleSuccessful(final GenericSpringEvent<String> event) {
2525
System.out.println("Handling generic event (conditional): " + event.getWhat());
2626
hitSuccessfulEventHandler = true;

spring-core-2/src/main/resources/scopes.xml spring-core/src/main/resources/scopes.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
55

6-
<bean id="personSingleton" class="com.baeldung.scopes.Person" scope="singleton"/>
6+
<bean id="personSingleton" class="com.baeldung.beanscopes.Person" scope="singleton"/>
77

8-
<bean id="personPrototype" class="com.baeldung.scopes.Person" scope="prototype"/>
8+
<bean id="personPrototype" class="com.baeldung.beanscopes.Person" scope="prototype"/>
99

1010
</beans>

spring-core-2/src/test/java/com/baeldung/scopes/ScopesIntegrationTest.java spring-core/src/test/java/com/baeldung/beanscopes/ScopesIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.scopes;
1+
package com.baeldung.beanscopes;
22

33
import org.junit.Assert;
44
import org.junit.Test;

spring-core-2/src/test/java/com/baeldung/applicationcontext/ApplicationContextProviderUnitTest.java spring-core/src/test/java/com/baeldung/currentapplicationcontext/ApplicationContextProviderUnitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.junit.jupiter.api.Test;
44
import org.junit.jupiter.api.extension.ExtendWith;

spring-core-2/src/test/java/com/baeldung/applicationcontext/MyBeanUnitTest.java spring-core/src/test/java/com/baeldung/currentapplicationcontext/MyBeanUnitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.junit.jupiter.api.Test;
44
import org.junit.jupiter.api.extension.ExtendWith;

spring-core-2/src/test/java/com/baeldung/applicationcontext/TestContextConfig.java spring-core/src/test/java/com/baeldung/currentapplicationcontext/TestContextConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.baeldung.applicationcontext;
1+
package com.baeldung.currentapplicationcontext;
22

33
import org.springframework.context.annotation.ComponentScan;
44
import org.springframework.context.annotation.Configuration;
55

66
@Configuration
7-
@ComponentScan("com.baeldung.applicationcontext")
7+
@ComponentScan("com.baeldung.currentapplicationcontext")
88
public class TestContextConfig {
99

1010

0 commit comments

Comments
 (0)