我创建了一个spring项目,更新了springmvc依赖this is my pom.xml
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.2</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>如您所见,我添加了springmvc并更新了log4j版本。我的主要方法是这样的:
public class Starter {
public static void main(String[] args){
Properties properties = new Properties();
properties.setProperty("dubbo.spring.config", "classpath:applicationContext.xml");
ConfigUtils.addProperties(properties);
Main.main(args);
}}
我运行它,没有错误
但是我可以访问80或8080端口的项目
如何修复它?谢谢
发布于 2019-01-22 17:10:52
Main.main是Dubbo容器中的一种方法,根据加载器的配置,它应该加载SpringContainer,然后再加载一个ClassPathXmlApplicationContext并启动它。
所以这个问题取决于你的applicationContext.xml文件中有什么,如果你不想暴露控制器,你可以修改applicationContext.xml来移除控制器或包扫描。
https://stackoverflow.com/questions/51567610
复制相似问题