This file contains hidden or 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
| package com.pig.spring.basics.springin5steps.cdi; | |
| import javax.inject.Inject; | |
| import javax.inject.Named; | |
| @Named | |
| public class SomeCdiBusiness { | |
| @Inject | |
| SomeCdiDao someCdiDao; |
This file contains hidden or 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
| package com.pig.spring.basics.springin5steps.cdi; | |
| import javax.inject.Named; | |
| @Named | |
| public class SomeCdiDao { | |
| //加入一個會回傳值的方法 | |
| public int [] getData() { | |
| return new int [] {5,89,100}; | |
| } |
This file contains hidden or 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
| package com.pig.spring.basics.springin5steps.cdi; | |
| import static org.junit.Assert.assertEquals; | |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.test.context.ContextConfiguration; | |
| import org.springframework.test.context.junit4.SpringRunner; |
This file contains hidden or 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
| package com.pig.spring.basics.springin5steps.cdi; | |
| import static org.junit.Assert.assertEquals; | |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.mockito.InjectMocks; | |
| import org.mockito.Mock; | |
| import org.mockito.Mockito; | |
| import org.mockito.runners.MockitoJUnitRunner; |
This file contains hidden or 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
| package camelinaction; | |
| import org.springframework.context.ApplicationContext; | |
| import org.springframework.context.support.ClassPathXmlApplicationContext; | |
| public class GreetMeBean { | |
| private Greeter greeter; | |
| public void setGreeter(Greeter greeter) { |
This file contains hidden or 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
| <?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="myGreeter" class="camelinaction.EnglishGreeter"/> | |
| <bean id="greetMeBean" class="camelinaction.GreetMeBean"> |
This file contains hidden or 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
| package camelinaction; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| public class FileCopier { |
This file contains hidden or 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
| package camelinaction; | |
| import org.apache.camel.CamelContext; | |
| import org.apache.camel.builder.RouteBuilder; | |
| import org.apache.camel.impl.DefaultCamelContext; | |
| public class FileCopierWithCamel { | |
| public static void main(String args[]) throws Exception { | |
| // create CamelContext |
This file contains hidden or 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
| package com.pig.springboot.basic.springbootin10steps; | |
| public class Book { | |
| long Id; | |
| String name; | |
| String author; | |
| //帶建構子 | |
| public Book(long id, String name, String author) { | |
| Id = id; |
This file contains hidden or 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
| package com.pig.springboot.basic.springbootin10steps; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| @RestController |