1在小组项目中的com.ssm.di.xml包下的Message,再定义printInfo方法或者重写toString方法,2 配置文件bean-di-xml.xml,实现Message的实体的实例化及属性的注入(

main
刘旭航 4 months ago
parent e499f36284
commit 3d75a6d88f

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="commons-logging-1.1.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/src/libs/commons-logging-1.1.1.jar!/" />
<root url="jar://$PROJECT_DIR$/src/libs/spring-aop-5.1.6.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/src/libs/spring-beans-5.1.6.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/src/libs/spring-context-5.1.6.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/src/libs/spring-core-5.1.6.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/src/libs/spring-expression-5.1.6.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Flowers-SpringProject-2205.iml" filepath="$PROJECT_DIR$/Flowers-SpringProject-2205.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="commons-logging-1.1.1" level="project" />
</component>
</module>

@ -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.xsd">
<bean id="message" class="com.ssm.di.xml.Message">
<property name="id" value="123456"></property>
<property name="content" value="好看"></property>
<property name="author" value="张三"></property>
<property name="age" value="22"></property>
</bean>
</beans>

@ -0,0 +1,15 @@
<?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.xsd">
<bean id="message" class="com.ssm.ioc.Message">
<property name="id" value="123456"></property>
<property name="content" value="好看"></property>
<property name="author" value="张三"></property>
<property name="age" value="22"></property>
</bean>
</beans>

@ -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.xsd">
<bean id="message" class="com.ssm.di.xml.Message">
<property name="id" value="123456"></property>
<property name="content" value="好看"></property>
<property name="author" value="张三"></property>
<property name="age" value="22"></property>
</bean>
</beans>

@ -0,0 +1,15 @@
<?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.xsd">
<bean id="message" class="com.ssm.ioc.Message">
<property name="id" value="123456"></property>
<property name="content" value="好看"></property>
<property name="author" value="张三"></property>
<property name="age" value="22"></property>
</bean>
</beans>

@ -0,0 +1,52 @@
package com.ssm.di.xml;
public class Message {
private int id;
private String content;
private String author;
private String age;
public Message() {
}
public Message(int id, String content, String author,String age) {
this.id = id;
this.content = content;
this.author = author;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getAge(){
return age;
}
public void setAge(String age){
this.age = age;
}
public void printInfo(){
System.out.println("\n用户id:"+getId()+"\n留言内容"+getContent()+"\n用户姓名"+getAuthor()+"\n用户年龄"+getAge());
}
}

@ -0,0 +1,52 @@
package com.ssm.ioc;
public class Message {
private int id;
private String content;
private String author;
private String age;
public Message() {
}
public Message(int id, String content, String author,String age) {
this.id = id;
this.content = content;
this.author = author;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getAge(){
return age;
}
public void setAge(String age){
this.age = age;
}
public void printInfo(){
System.out.println("\n用户id:"+getId()+"\n留言内容"+getContent()+"\n用户姓名"+getAuthor()+"\n用户年龄"+getAge());
}
}
Loading…
Cancel
Save