Skip to content

Commit

Permalink
add demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
ljinshuan committed Jun 2, 2018
1 parent 751c761 commit 45affa7
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 11 deletions.
Binary file not shown.
1 change: 0 additions & 1 deletion pom.xml
Expand Up @@ -15,7 +15,6 @@
<module>tac-container</module>
<module>tac-engine</module>
<module>tac-infrastructure</module>
<module>tac-custom-datasource</module>
</modules>


Expand Down
2 changes: 1 addition & 1 deletion tac-console/src/main/resources/application.properties
Expand Up @@ -5,7 +5,7 @@ server.port=7001


# scan the extend package names
scan.package.name=com.tmall.tac.test
scan.package.name=com.tmall.itemcenter

# the location of extend jars
tac.extend.lib=extendlibs
Expand Down
Expand Up @@ -7,10 +7,12 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>tac-custom-datasource</artifactId>
<version>0.0.4-SNAPSHOT</version>

<artifactId>tac-custom-datasource-demo</artifactId>
<packaging>jar</packaging>

<name>tac-custom-datasource</name>
<name>tac-custom-datasource-demo</name>
<url>http://maven.apache.org</url>

<properties>
Expand All @@ -21,7 +23,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>tac-sdk</artifactId>
<version>${project.version}</version>
<version>0.0.4</version>
</dependency>
</dependencies>
</project>
8 changes: 6 additions & 2 deletions tac-dev-source/pom.xml → tac-dev-source-demo/pom.xml
Expand Up @@ -10,7 +10,7 @@
<artifactId>tac-dev-source</artifactId>
<packaging>jar</packaging>

<name>tac-dev-source</name>
<name>tac-dev-source-demo</name>
<url>http://maven.apache.org</url>

<properties>
Expand All @@ -23,7 +23,11 @@
<artifactId>tac-sdk</artifactId>
<version>0.0.4</version>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>tac-custom-datasource-demo</artifactId>
<version>0.0.4-SNAPSHOT</version>
</dependency>
</dependencies>


Expand Down
Expand Up @@ -5,6 +5,8 @@
import com.alibaba.tac.sdk.factory.TacInfrasFactory;
import com.alibaba.tac.sdk.handler.TacHandler;
import com.alibaba.tac.sdk.infrastracture.TacLogger;
import com.tmall.itemcenter.ItemDO;
import com.tmall.itemcenter.TmallItemService;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -19,10 +21,11 @@ public class HelloWorldTac implements TacHandler<Object> {
*/
private TacLogger tacLogger = TacInfrasFactory.getLogger();

private TmallItemService tmallItemService = TacInfrasFactory.getServiceBean(TmallItemService.class);

/**
* implement a class which implements TacHandler interface
* {@link TacHandler}
* implement a class which implements TacHandler interface {@link TacHandler}
*
* @param context
* @return
* @throws Exception
Expand All @@ -40,8 +43,8 @@ public TacResult<Object> execute(Context context) throws Exception {
data.put("clientVersion", "7.0.2");
data.put("userName", "tac-userName");



ItemDO item = tmallItemService.getItem(1L);
data.put("item", item);
return TacResult.newResult(data);
}
}
6 changes: 6 additions & 0 deletions tac-infrastructure/pom.xml
Expand Up @@ -74,6 +74,12 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
</dependency>

<!-- <dependency>
<groupId>com.alibaba</groupId>
<artifactId>tac-custom-datasource-demo</artifactId>
<version>0.0.4-SNAPSHOT</version>
</dependency>-->
</dependencies>

<build>
Expand Down

0 comments on commit 45affa7

Please sign in to comment.