fix component code templates problem

This commit is contained in:
chengpu
2023-03-21 15:58:33 +08:00
parent e509820542
commit 0681d601be
44 changed files with 5 additions and 183 deletions

View File

@@ -1,29 +0,0 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package {{basePackage}}.demos.acm;
import org.springframework.context.annotation.Configuration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author xiaolongzuo
*/
@Configuration
@EnableDiscoveryClient
public class AcmConfiguration {
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package {{basePackage}}.demos.acm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author xiaolongzuo
*/
@RestController
@RefreshScope
public class EchoController {
private static final Logger LOGGER = LoggerFactory.getLogger(EchoController.class);
@Value("${user.id}")
private String userId;
@RequestMapping("/")
public String echo() {
LOGGER.info("User id is " + userId);
return userId;
}
}

View File

@@ -1,3 +0,0 @@
spring.cloud.alicloud.acm.server-list=127.0.0.1
spring.cloud.alicloud.acm.server-port=8080

View File

@@ -1,29 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package {{basePackage}}.nacosconfig;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@EnableAutoConfiguration
@Configuration
public class NacosConfigConfiguration {
}

View File

@@ -20,7 +20,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@FeignClient("nacos-discovery-provider-sample") // 指向服务提供者应用
@FeignClient("nacos-service") // 指向服务提供者应用
public interface EchoService {
@GetMapping("/echo/{message}")

View File

@@ -39,7 +39,7 @@ public class RestTemplateController {
@GetMapping("/call/echo/{message}")
public String callEcho(@PathVariable String message) {
// 访问应用 nacos-discovery-provider-sample 的 REST "/echo/{message}"
return restTemplate.getForObject("http://nacos-discovery-provider-sample/echo/" + message, String.class);
// 访问应用 nacos-service 的 REST "/echo/{message}"
return restTemplate.getForObject("http://nacos-service/echo/" + message, String.class);
}
}

View File

@@ -1,4 +1,5 @@
# Nacos帮助文档: https://nacos.io/zh-cn/docs/concepts.html
spring.application.name=nacos-service
# Nacos认证信息
spring.cloud.nacos.discovery.username=nacos
spring.cloud.nacos.discovery.password=nacos

View File

@@ -1,28 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.demo.sentinel.api;
/**
* 该接口为 Dubbo 的服务端、消费端公用的接口定义。
* 当前案例中通过复制代码的方式实现接口发布这不是最优雅的使用方法。更好的建议是通过maven坐标的方式独立维护api。
*/
public interface FooService {
String sayHello(String name);
long getCurrentTime(boolean slow);
}

View File

@@ -1,41 +0,0 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package {{basePackage}}.demos.sentinelprovider;
import com.alibaba.cloud.demo.sentinel.api.FooService;
import org.apache.dubbo.config.annotation.Service;
/**
* @author Eric Zhao
*/
@Service
public class FooServiceImpl implements FooService {
@Override
public String sayHello(String name) {
return "Hello, " + name;
}
@Override
public long getCurrentTime(boolean slow) {
// Simulate slow invocations randomly.
if (slow) {
try {
Thread.sleep(100);
} catch (InterruptedException ignored) {
}
}
return System.currentTimeMillis();
}
}

View File

@@ -1,3 +0,0 @@
# dubbo 服务扫描基准包
dubbo.scan.base-packages={{basePackage}}