我准备为我的scala应用程序构建一个UI.我对Angular 1有一些很好的了解,而且我对Angular 2知之甚少.
我问的问题是我是否应该将Angular 2用于我的新应用程序而不是Angular 1.
我用Google搜索并阅读了一些关于Angular 2与Angular 1已经知道的事情的文章,但我对专家对此主题的看法更感兴趣.我在这里提出问题的原因是这个主题在前两页没有任何答案.我的应用程序在这一点上并不大,而且不会那么大.
那么我应该坚持使用Angular 1还是去Angular 2?为什么?
我正在使用Eclipse PDT,我想使用Phpdoc注释一个局部变量.
我所看到的是,我可以使用@var或甚至
注释类的变量/属性@property,但这对于局部变量有何可能?
我怎么能这样做?
function foo(){
/** @var Stock $a */
$a->save();
}
Run Code Online (Sandbox Code Playgroud) 我有一个Spring Boot应用程序,我在启动时得到以下消息:
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalCommonAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'application': no URL paths identified …Run Code Online (Sandbox Code Playgroud) 如果有可能Stream从春天回来,我很好奇RestController
@RestController
public class X {
@RequestMapping(...)
public Stream<?> getAll() { ... }
}
Run Code Online (Sandbox Code Playgroud)
做这样的事情可以吗?我尝试过,Spring返回除了流的值以外的其他内容.
我要一直回来List<?>吗?
我有以下小提琴https://jsfiddle.net/91vLms06/1/
const CreateComponent = Vue.component('create', {
props: ['user', 'otherProp'],
template: '<div>User data: {{user}}; other prop: {{otherProp}}</div>'
});
const ListComponent = Vue.component('List', {
template: '<div>Listing</div>'
});
const app = new Vue({
el: '#app',
router: new VueRouter(),
created: function () {
const self = this;
// ajax request returning the user
const userData = {'name': 'username'}
self.$router.addRoutes([
{ path: '/create', name: 'create', component: CreateComponent, props: { user: userData }},
{ path: '/list', name: 'list', component: ListComponent },
{ path: '*', redirect: …Run Code Online (Sandbox Code Playgroud) 我正在使用MockMVC来测试我的控制器.
我有以下控制器:
public class A{
...
@RequestMapping("/get")
public List<ADTO> get(@RequestParam(defaultValue = "15", required = false) Integer limit) throws IOException {
if(limit <= 0 || limit >= 50){
throw new IllegalArgumentException();
}
...
return aDTOs;
}
}
Run Code Online (Sandbox Code Playgroud)
我目前的测试看起来像这样:
@Test
public void testGetAllLimit0() throws Exception {
mockMvc.perform(get("/A/get")
.param("limit","0")
)
.andDo(print())
.andExpect(...);
}
Run Code Online (Sandbox Code Playgroud)
我用这个实例化MockMVC:
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能处理控制器中抛出的异常?
后来编辑:
我不确定最近我的代码中发生了什么,但它通过了测试:
@Test
public void testGetAllLimit0() throws Exception {
mockMvc.perform(get("/A/get")
.param("limit","0")
)
.andDo(print())
.andExpect(status().is(500));
}
Run Code Online (Sandbox Code Playgroud)
如果我取代它仍然通过is(500)使用isOk() …
我想从网络外的计算机访问我的网页.我们的网络有IP,如192.168.0.1-192.168.0.255.网络通过本地网关192.168.0.1连接到Internet,并转到DNS服务器193.xxx.xxx.xxx.
假设我的电脑的IP为192.168.0.50.我如何通过我的服务器(Apache)从不是来自我们网络的计算机(比如254.231.52.xxx)获取我的网站?
谢谢!
我遇到了一个问题,似乎很多人遇到了它,可能无法解决它.
我有以下MYSQL存储过程.这只是一个示例,看看是否一切正常,然后我会开始添加像这样的参数inactive.
CREATE DEFINER=`root`@`localhost` PROCEDURE `get_resource_types`()
BEGIN
SELECT *
FROM resource_types
WHERE inactive = 0;
END
Run Code Online (Sandbox Code Playgroud)
映射resource_types表和命名存储过程查询的实体.
@NamedStoredProcedureQuery(
name="getResourceTypes",
procedureName="get_resource_types",
resultClasses = ResourceType.class,
parameters = {}
)
@Entity
@Table(name = "resource_types")
public class ResourceType {
... fields with annotations used for validation + getters and setters ...
}
Run Code Online (Sandbox Code Playgroud)
这是我JpaRepository从中调用存储过程的
@Repository
public interface ResourceTypeRepository extends JpaRepository<ResourceType, Long> {
@Procedure("ResourceType.getResourceTypes")
List<ResourceType> getResourceTypes();
}
Run Code Online (Sandbox Code Playgroud)
getAll()居住在的方法@Service
public List<ResourceType> getAll(){
final List<ResourceType> resourceTypes = resourceTypeRepository.getResourceTypes();
return resourceTypes; …Run Code Online (Sandbox Code Playgroud) 如何将包含键和值的两个数组与具有键->值对的一个数组关联?
在Mootools中,有执行以下associate功能的函数:
var animals = ['Cow', 'Pig', 'Dog', 'Cat'];
var sounds = ['Moo', 'Oink', 'Woof', 'Miao'];
sounds.associate(animals);
// returns {'Cow': 'Moo', 'Pig': 'Oink', 'Dog': 'Woof', 'Cat': 'Miao'}
Run Code Online (Sandbox Code Playgroud)
JQuery中是否有任何类似的函数可以从这两个数组中获得相同的结果?
如果没有,我该怎么办?
我正在寻找一种"包装"所有$http请求的方法,这样我可以gif在应用程序进行某些处理时显示图像.我也希望将相同的解决方案用于其他类型的后台处理而不仅仅是$http.
为什么我问的原因是我总要为我设置processingIndicator到true,然后我切换回success函数,而不是优雅的.
我看到的一个可能的解决方案是使用一个函数将函数作为参数.此函数将设置processingIndicator为true,调用该函数,然后设置processingIndicator回"false".
function processAjaxRequestSuccessFn(fooFn){
// display processing indicator
fooFn();
// hide processing indicator
}
Run Code Online (Sandbox Code Playgroud)
然后
$http.get(...).then(processAjaxRequestSuccessFn, processAjaxRequestErrorFn)
Run Code Online (Sandbox Code Playgroud)
这个解决方案不是很方便,因为每次我需要通知用户发生了什么事情时,我需要使用这个功能.
我正在寻找一种自动化这个过程的方法.
还有其他想法吗?
稍后编辑
另一个想法我是延长$http我自己的get,post等等,或者创建具有类似行为的自定义服务.但仍然不是很优雅.