parent
a5bb440a05
commit
91b59f538a
|
|
@ -5,7 +5,6 @@ import com.ai.cloud.skywalking.example.account.dao.mapper.interfaces.TAccountMap
|
|||
import com.ai.cloud.skywalking.example.account.dubbo.interfaces.param.AccountInfo;
|
||||
import com.ai.cloud.skywalking.example.account.exception.BusinessException;
|
||||
import com.ai.cloud.skywalking.example.account.manage.IAccountMaintainService;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
|
|
@ -23,7 +22,6 @@ public class AccountMaintainServiceImpl implements IAccountMaintainService {
|
|||
private SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
@Tracing
|
||||
public boolean createAccount(AccountInfo accountInfo) throws BusinessException {
|
||||
if (accountInfo.getPhoneNumber() == null || accountInfo.getPhoneNumber().length() <= 0) {
|
||||
throw new BusinessException("Phone number cannot be null");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.ai.cloud.skywalking.example.account.util;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.httpclient.SWTracingHttpClient;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpEntity;
|
||||
|
|
@ -24,7 +23,6 @@ import java.util.Map;
|
|||
public class HttpClientUtil {
|
||||
private static final Log logger = LogFactory.getLog(HttpClientUtil.class);
|
||||
|
||||
@Tracing
|
||||
public static String sendPostRequest(String url, Map<String, String> parametersMap) throws IOException, URISyntaxException {
|
||||
HttpClient httpclient = new SWTracingHttpClient(new DefaultHttpClient());
|
||||
HttpPost httpPost = new HttpPost(new URL(url).toURI());
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
<?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
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://cloud.asiainfo.com/schema/skywalking
|
||||
http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
|
||||
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.account"/>
|
||||
<import resource="context/spring-mybatis.xml"/>
|
||||
<import resource="provider/provider.xml"/>
|
||||
<skywalking:trace className="*" method="*"
|
||||
packageName="com.ai.cloud.skywalking.example.*" />
|
||||
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.account" />
|
||||
<import resource="context/spring-mybatis.xml" />
|
||||
<import resource="provider/provider.xml" />
|
||||
</beans>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ai.cloud.skywalking.example.mail.util;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
|
|
@ -8,12 +9,9 @@ import javax.mail.Session;
|
|||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class SendeUtil {
|
||||
|
||||
@Tracing
|
||||
public static boolean sendeMail(String recipientAccount) {
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
|
||||
|
||||
<bean id="postProcess1"
|
||||
class="com.ai.cloud.skywalking.plugin.spring.TracingEnhanceProcessor">
|
||||
</bean>
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
|
||||
http://cloud.asiainfo.com/schema/skywalking
|
||||
http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
|
||||
|
||||
<!-- 默认的注解映射的支持 -->
|
||||
<mvc:annotation-driven/>
|
||||
|
|
@ -33,4 +32,5 @@
|
|||
</bean>
|
||||
<!-- 对静态资源文件的访问 -->
|
||||
<mvc:default-servlet-handler/>
|
||||
<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.*"/>
|
||||
</beans>
|
||||
|
|
@ -2,5 +2,5 @@ mail.host=mail.asiainfo.com
|
|||
mail.transport.protocol=smtp
|
||||
mail.smtp.auth=true
|
||||
mail.username=zhangxin10
|
||||
mail.password=!qaz2wsx
|
||||
mail.password=3nj0yBV
|
||||
mail.account.prefix=@asiainfo.com
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
package com.ai.cloud.skywalking.example.order.service.impl;
|
||||
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ai.cloud.skywalking.example.order.dao.mapper.bo.TOrder;
|
||||
import com.ai.cloud.skywalking.example.order.dao.mapper.interfaces.TOrderMapper;
|
||||
import com.ai.cloud.skywalking.example.order.interfaces.parameter.OrderInfo;
|
||||
import com.ai.cloud.skywalking.example.order.service.IOrderManage;
|
||||
import com.ai.cloud.skywalking.example.order.util.OrderIdGenerator;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
|
|
@ -19,7 +19,6 @@ public class OrderManageImpl implements IOrderManage {
|
|||
private SqlSessionTemplate sqlSessionTemplate;
|
||||
|
||||
@Override
|
||||
@Tracing
|
||||
public String saveOrder(OrderInfo orderInfo) {
|
||||
String orderId = OrderIdGenerator.generate();
|
||||
TOrderMapper iOrderMapper = sqlSessionTemplate.getMapper(TOrderMapper.class);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,14 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
|
||||
|
||||
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://cloud.asiainfo.com/schema/skywalking
|
||||
http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
|
||||
|
||||
|
||||
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
|
|
@ -53,4 +56,7 @@
|
|||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.order.service.*"/>
|
||||
<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.order.dao.*"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.ai.cloud.skywalking.example.resource.dubbo.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.ai.cloud.skywalking.example.resource.dubbo.interfaces.checker.IResourceCheck;
|
||||
import com.ai.cloud.skywalking.example.resource.dubbo.interfaces.checker.param.ResourceInfo;
|
||||
import com.ai.cloud.skywalking.example.resource.service.IResourceManage;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Service
|
||||
public class ResourceCheckImpl implements IResourceCheck {
|
||||
|
|
@ -14,12 +14,10 @@ public class ResourceCheckImpl implements IResourceCheck {
|
|||
private IResourceManage resourceManage;
|
||||
|
||||
@Override
|
||||
@Tracing
|
||||
public boolean checkResource(ResourceInfo info) {
|
||||
return resourceManage.checkResource(info);
|
||||
}
|
||||
|
||||
@Tracing
|
||||
public boolean reservationResource(ResourceInfo info) {
|
||||
return resourceManage.reservationResource(info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.ai.cloud.skywalking.example.resource.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ai.cloud.skywalking.example.resource.dao.ResourceDAO;
|
||||
import com.ai.cloud.skywalking.example.resource.dubbo.interfaces.checker.param.ResourceInfo;
|
||||
import com.ai.cloud.skywalking.example.resource.exception.BusinessException;
|
||||
import com.ai.cloud.skywalking.example.resource.service.IResourceManage;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ResourceManageImpl implements IResourceManage {
|
||||
|
|
@ -16,20 +16,18 @@ public class ResourceManageImpl implements IResourceManage {
|
|||
|
||||
|
||||
@Override
|
||||
@Tracing
|
||||
public boolean checkResource(ResourceInfo resourceInfo) throws BusinessException {
|
||||
return checkPhoneNumber(resourceInfo.getPhoneNumber()) && checkResourceId(resourceInfo.getResourceId()) &&
|
||||
checkPhonePackage(resourceInfo.getPhonePackage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Tracing
|
||||
public boolean reservationResource(ResourceInfo resourceInfo) {
|
||||
return resourceDAO.updatePhoneNumberStatus(resourceInfo.getPhoneNumber())
|
||||
&& resourceDAO.updateResourceStatus(resourceInfo.getResourceId());
|
||||
}
|
||||
|
||||
@Tracing
|
||||
|
||||
public boolean checkPhoneNumber(String phoneNumber) throws BusinessException {
|
||||
if (resourceDAO.selectPhoneNumberStatus(phoneNumber) == null) {
|
||||
throw new BusinessException("Cannot find phone number[" + phoneNumber + "]");
|
||||
|
|
@ -43,7 +41,7 @@ public class ResourceManageImpl implements IResourceManage {
|
|||
|
||||
}
|
||||
|
||||
@Tracing
|
||||
|
||||
public boolean checkResourceId(String resourceId) throws BusinessException {
|
||||
if (resourceDAO.selectResourceStatus(resourceId) == null) {
|
||||
throw new BusinessException("Cannot find resourceId[" + resourceId + "]");
|
||||
|
|
@ -56,7 +54,7 @@ public class ResourceManageImpl implements IResourceManage {
|
|||
}
|
||||
}
|
||||
|
||||
@Tracing
|
||||
|
||||
public boolean checkPhonePackage(String packageId) throws BusinessException {
|
||||
if (resourceDAO.selectResourceStatus(packageId) == null) {
|
||||
throw new BusinessException("Cannot find package Id[" + packageId + "]");
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
<?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
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
<bean id="postProcess1"
|
||||
class="com.ai.cloud.skywalking.plugin.spring.TracingEnhanceProcessor">
|
||||
</bean>
|
||||
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.resource"/>
|
||||
<import resource="provider/dubbo-provider.xml"/>
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://cloud.asiainfo.com/schema/skywalking
|
||||
http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
|
||||
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.resource" />
|
||||
<import resource="provider/dubbo-provider.xml" />
|
||||
<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.resource.service.*"/>
|
||||
<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.resource.dao.*"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -1,15 +1,19 @@
|
|||
package com.ai.cloud.skywalking.example.controller;
|
||||
|
||||
import com.ai.cloud.skywalking.api.BusinessKeyAppender;
|
||||
import com.ai.cloud.skywalking.example.order.interfaces.IOrderMaintain;
|
||||
import com.ai.cloud.skywalking.example.order.interfaces.parameter.OrderInfo;
|
||||
import com.ai.cloud.skywalking.plugin.spring.Tracing;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.ai.cloud.skywalking.api.BusinessKeyAppender;
|
||||
import com.ai.cloud.skywalking.example.order.interfaces.IOrderMaintain;
|
||||
import com.ai.cloud.skywalking.example.order.interfaces.parameter.OrderInfo;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/order")
|
||||
|
|
@ -18,8 +22,10 @@ public class OrderSaveController {
|
|||
@Reference
|
||||
private IOrderMaintain orderMaintain;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Tracing
|
||||
public ModelAndView save(HttpServletRequest req) {
|
||||
String phoneNumber = req.getParameter("phoneNumber");
|
||||
String resourceId = req.getParameter("resourceId");
|
||||
|
|
@ -27,7 +33,7 @@ public class OrderSaveController {
|
|||
String mail = req.getParameter("mail");
|
||||
|
||||
String businessKey = "phoneNumber:" + phoneNumber + ",resourceId:" + resourceId + ",mail:" + mail;
|
||||
BusinessKeyAppender.setBusinessKey2Trace(businessKey);
|
||||
BusinessKeyAppender.setBusinessKey2Trace(businessKey);
|
||||
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setResourceId(resourceId);
|
||||
|
|
@ -39,4 +45,5 @@ public class OrderSaveController {
|
|||
ModelAndView view = new ModelAndView("order/saveOrderResult");
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,37 @@
|
|||
<?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"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
|
||||
http://cloud.asiainfo.com/schema/skywalking
|
||||
http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
|
||||
|
||||
<!-- 默认的注解映射的支持 -->
|
||||
<mvc:annotation-driven />
|
||||
|
||||
<bean id="postProcess1"
|
||||
class="com.ai.cloud.skywalking.plugin.spring.TracingEnhanceProcessor">
|
||||
</bean>
|
||||
|
||||
<!-- 默认的注解映射的支持 -->
|
||||
<mvc:annotation-driven/>
|
||||
|
||||
<!-- 设置使用注解的类所在的jar包 ,当使用 <context:component-scan/> 后,就可以将 <context:annotation-config/>
|
||||
移除了 -->
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.controller"/>
|
||||
<!-- 设置使用注解的类所在的jar包 ,当使用 <context:component-scan/> 后,就可以将 <context:annotation-config/>
|
||||
移除了 -->
|
||||
<context:component-scan base-package="com.ai.cloud.skywalking.example.controller" />
|
||||
|
||||
|
||||
<!-- 完成请求和注解POJO的映射 -->
|
||||
<!--<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>-->
|
||||
<!-- 完成请求和注解POJO的映射 -->
|
||||
<!--<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/> -->
|
||||
|
||||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/jsp/"/>
|
||||
<property name="suffix" value=".jsp"/>
|
||||
<property name="viewClass"
|
||||
value="org.springframework.web.servlet.view.JstlView"/>
|
||||
</bean>
|
||||
<!-- 对静态资源文件的访问 -->
|
||||
<mvc:default-servlet-handler/>
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/jsp/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
<property name="viewClass"
|
||||
value="org.springframework.web.servlet.view.JstlView" />
|
||||
</bean>
|
||||
<!-- 对静态资源文件的访问 -->
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
<import resource="consumer/dubbo-consumer.xml"/>
|
||||
<import resource="consumer/dubbo-consumer.xml" />
|
||||
<skywalking:trace className="*" method="save" packageName="com.ai.cloud.skywalking.example.controller"/>
|
||||
</beans>
|
||||
Loading…
Reference in New Issue