Baeldung eclipse formatter added.

This commit is contained in:
gschambial 2017-11-10 18:14:31 +05:30
parent 8c8af4e9bf
commit b2dead9484
30 changed files with 366 additions and 347 deletions

View File

@ -4,7 +4,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages= { "com.baeldung.di.constructor.model.autowire" })
@ComponentScan(basePackages = { "com.baeldung.di.constructor.model.autowire" })
public class SpringAutowireConstructorContext {
}

View File

@ -11,17 +11,17 @@ import com.baeldung.di.constructor.model.bean.Processor;
public class SpringBeanConstructorContext {
@Bean
public Computer computer(){
public Computer computer() {
return new Computer(processor(), memory());
}
@Bean
public Processor processor(){
public Processor processor() {
return new Processor();
}
@Bean
public Memory memory(){
public Memory memory() {
return new Memory();
}

View File

@ -16,10 +16,14 @@ public class ComputerAutowireFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Constructor Injection via @Autowire------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Constructor Injection via @Autowire------------------");
// Close Spring Application Context
((ConfigurableApplicationContext) context).close();

View File

@ -16,10 +16,14 @@ public class ComputerBeanFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Constructor Injection via @Bean ------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Constructor Injection via @Bean ------------------");
// Close Spring Application Context

View File

@ -6,8 +6,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.baeldung.di.constructor.model.xml.Computer;
public class ComputerXmlFactory {
public static void main(String[] args) {
@ -17,10 +15,14 @@ public class ComputerXmlFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Constructor Injection via XML ------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Constructor Injection via XML ------------------");
// Close Spring Application Context

View File

@ -4,7 +4,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages= { "com.baeldung.di.setter.model.autowire" })
@ComponentScan(basePackages = { "com.baeldung.di.setter.model.autowire" })
public class SpringAutowireSetterContext {
}

View File

@ -11,7 +11,7 @@ import com.baeldung.di.setter.model.bean.Processor;
public class SpringBeanSetterContext {
@Bean
public Computer computer(){
public Computer computer() {
Computer computer = new Computer();
computer.setProcessor(processor());
computer.setMemory(memory());
@ -19,12 +19,12 @@ public class SpringBeanSetterContext {
}
@Bean
public Processor processor(){
public Processor processor() {
return new Processor();
}
@Bean
public Memory memory(){
public Memory memory() {
return new Memory();
}

View File

@ -7,7 +7,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import com.baeldung.di.setter.config.SpringAutowireSetterContext;
import com.baeldung.di.setter.model.autowire.Computer;
public class ComputerAutowireFactory {
public static void main(String[] args) {
@ -17,10 +16,14 @@ public class ComputerAutowireFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Setter Injection via @Autowire ------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Setter Injection via @Autowire ------------------");
// Close Spring Application Context
((ConfigurableApplicationContext) context).close();

View File

@ -7,7 +7,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import com.baeldung.di.setter.config.SpringBeanSetterContext;
import com.baeldung.di.setter.model.bean.Computer;
public class ComputerBeanFactory {
public static void main(String[] args) {
@ -17,10 +16,14 @@ public class ComputerBeanFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Setter Injection via @Bean ------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Setter Injection via @Bean ------------------");
// Close Spring Application Context

View File

@ -6,8 +6,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.baeldung.di.setter.model.xml.Computer;
public class ComputerXmlFactory {
public static void main(String[] args) {
@ -17,10 +15,14 @@ public class ComputerXmlFactory {
// Get Spring bean "computer" created
Computer computer = (Computer) context.getBean("computer");
System.out.println("---------------- Setter Injection via XML ------------------");
System.out.println("Processor cores : " + computer.getProcessor().getCores());
System.out.println("Processor frequency : " + computer.getProcessor().getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory().getSizeInGb());
System.out.println("Memory format : " + computer.getMemory().getFormat());
System.out.println("Processor cores : " + computer.getProcessor()
.getCores());
System.out.println("Processor frequency : " + computer.getProcessor()
.getFrequency());
System.out.println("Memory Size in GB : " + computer.getMemory()
.getSizeInGb());
System.out.println("Memory format : " + computer.getMemory()
.getFormat());
System.out.println("---------------- Setter Injection via XML ------------------");
// Close Spring Application Context
((ConfigurableApplicationContext) context).close();

View File

@ -5,6 +5,7 @@ public class Memory {
private Integer sizeInGb = 16;
private String format = "DDR3";
//
public Integer getSizeInGb() {
return sizeInGb;
}

View File

@ -13,7 +13,7 @@
<bean id="computer" class="com.baeldung.di.constructor.model.xml.Computer">
<constructor-arg ref="processor"/>
<constructor-arg ref="processor" />
<constructor-arg ref="memory" />
</bean>