Есть два класса main и postmain.
public class Main {
static int rnd=555;
public static void main(String[] args) {
}
}
и
public class PostMain {
int a;
public PostMain(int a) {
this.a = a;
}
public void print(){
System.out.println(a);
}
}
Я хочу передать в бин postmain переменную rnd, которая находится в классе main через конструктор. Как сделать это через аннотации я нашел. Вопрос - как сделать это в XML файле? Пример моего xml файла:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="postMain" class="tetttsts.PostMain">
<constructor-arg
</bean>
</beans>