-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature/lesson4-quoc #12
Open
conalpham
wants to merge
1
commit into
feature/lesson4
Choose a base branch
from
feature/lesson4-quoc
base: feature/lesson4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>SpringDI</groupId> | ||
<artifactId>SpringDI</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>4.3.13.RELEASE</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>4.3.13.RELEASE</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
17 changes: 8 additions & 9 deletions
17
...loperpro/k001/danghuucanh/HelloWorld.java → ...k001/JavaBackEnd/SpringDI/HelloWorld.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
package com.trainingdeveloperpro.k001.danghuucanh; | ||
package com.k001.JavaBackEnd.SpringDI; | ||
|
||
public class HelloWorld { | ||
private String message; | ||
|
||
public HelloWorld(){ | ||
|
||
public HelloWorld() { | ||
} | ||
|
||
public HelloWorld(String message){ | ||
this.message = message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
public HelloWorld(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public void print(){ | ||
System.out.println("Print " + this.message); | ||
System.out.println("Print: "+ this.message); | ||
} | ||
} |
13 changes: 6 additions & 7 deletions
13
...ngdeveloperpro/k001/danghuucanh/Main.java → ...om/k001/JavaBackEnd/SpringDI/MainApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
package com.trainingdeveloperpro.k001.danghuucanh; | ||
package com.k001.JavaBackEnd.SpringDI; | ||
|
||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
public class Main { | ||
public class MainApp { | ||
public static void main(String[] args) { | ||
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); | ||
|
||
HelloWorld helloWorld1 = (HelloWorld) context.getBean("helloWorld1"); | ||
ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml"); | ||
HelloWorld helloWorld1 = (HelloWorld)context.getBean("helloWorld1"); | ||
helloWorld1.print(); | ||
|
||
HelloWorld helloWorld2 = (HelloWorld) context.getBean("helloWorld2"); | ||
HelloWorld helloWorld2 = (HelloWorld)context.getBean("helloWorld2"); | ||
helloWorld2.print(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> | ||
|
||
<bean id="helloWorld1" class="com.k001.JavaBackEnd.SpringDI.HelloWorld"> | ||
<property name="message" value="inject by setter" /> | ||
</bean> | ||
|
||
<bean id="helloWorld2" class="com.k001.JavaBackEnd.SpringDI.HelloWorld"> | ||
<constructor-arg value="inject by constructor" type="String"></constructor-arg> | ||
</bean> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> | ||
|
||
<bean id="helloWorld1" class="com.k001.JavaBackEnd.SpringDI.HelloWorld"> | ||
<property name="message" value="inject by setter" /> | ||
</bean> | ||
|
||
<bean id="helloWorld2" class="com.k001.JavaBackEnd.SpringDI.HelloWorld"> | ||
<constructor-arg value="inject by constructor" type="String"></constructor-arg> | ||
</bean> | ||
|
||
</beans> |
Binary file added
BIN
+1001 Bytes
SpringDI/target/classes/com/k001/JavaBackEnd/SpringDI/HelloWorld.class
Binary file not shown.
Binary file added
BIN
+967 Bytes
SpringDI/target/classes/com/k001/JavaBackEnd/SpringDI/MainApp.class
Binary file not shown.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/com/trainingdeveloperpro/k001/dokhuongduy/Main.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/com/trainingdeveloperpro/k001/hoangtrieuthang/Main.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/com/trainingdeveloperpro/k001/nguyentrungkhanh/Main.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/com/trainingdeveloperpro/k001/phamminhquoc/Main.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/com/trainingdeveloperpro/k001/phamtuananh/Main.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chú ý cách đặt groupId với artifactId theo quy tắc nhé, nên để trùng với project gốc