小编ako*_*kis的帖子

通过注释设置与Spring的JNDI连接

我尝试使用JNDI属性通过注释方式将Spring设置为数据库连接.我设置了我的server.xml

<Resource name="jdbc/cms"
          global="jdbc/cms"
          auth="Container"
          type="javax.sql.DataSource"
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/cms"
          username="root"
          password="admin"
          maxActive="100"
          maxIdle="20"
          minIdle="5"
          maxWait="10000"/>
Run Code Online (Sandbox Code Playgroud)

的context.xml

<ResourceLink name="jdbc/cms"
                    global="jdbc/cms"
                    auth="Container"
                    type="javax.sql.DataSource" />
Run Code Online (Sandbox Code Playgroud)

DispatcherServlet的

public class Dispatcher implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException{
        AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext();
        appContext.register(ApplicationContext.class);
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("SpringDispatcher", new DispatcherServlet(appContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");
    }
}
Run Code Online (Sandbox Code Playgroud)

appicationContext

@Configuration
@ComponentScan("com.myproject")
@EnableTransactionManagement
public class ApplicationContext {

    @Bean(name="dataSource")
    @Resource(name="jdbc/cms")
    public DataSource getDataSource(){
        JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
        dsLookup.setResourceRef(true);
        DataSource dataSource = dsLookup.getDataSource("java:comp/env/jdbc/cms");
        return dataSource;
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试运行我的项目时,我可以看到这个东西:

Caused …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat jndi

5
推荐指数
1
解决办法
7812
查看次数

Angular2 上的 Interact.js 与 DefinelyTyped

我在我的项目中安装了interact.js angular2,但我不知道如何使用文档中描述的方法。

我的导入如下

import * as _ from 'interact';
Run Code Online (Sandbox Code Playgroud)

Angular2 中是否有可能提供完整的 interact.js 服务?如何创建对拖放的支持?

DT https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/interact.js

definitelytyped interact.js angular

5
推荐指数
1
解决办法
2819
查看次数

在 Azure Devops Pipelines 中的部署作业生命周期挂钩之间共享变量

我一直在尝试在部署作业的生命周期挂钩中定义一个变量,然后在以后的生命周期挂钩中访问该变量。关于部署作业文档引用了这样做的能力,但没有提供这种情况的实际示例(额外强调):

在部署作业的生命周期挂钩中定义输出变量,并在同一阶段的其他下游步骤和作业中使用它们。

我一直在使用的示例管道:

stages:
- stage: Pipeline
  jobs:
  - deployment: Deploy
    environment: 'testing'
    strategy:
      runOnce:
        preDeploy:
          steps:
          - bash: |
              echo "##vso[task.setvariable variable=myLocalVar;isOutput=false]local variable"
            name: setvarStep
          - bash: |
              echo "##vso[task.setvariable variable=myOutputVar;isOutput=true]output variable"
            name: outvarStep
          - bash: |
              echo 'Both $(myLocalVar) and $(outvarStep.myOutputVar) are available here'
              echo "Both $(myLocalVar) and $(outvarStep.myOutputVar) are available here"
        deploy:
          steps:
          - bash: |
              echo 'Neither $(myLocalVar) nor $(outvarStep.myOutputVar) are available here'
              echo "Neither $(myLocalVar) nor $(outvarStep.myOutputVar) are available …
Run Code Online (Sandbox Code Playgroud)

azure azure-devops azure-pipelines

4
推荐指数
1
解决办法
719
查看次数