Ale*_*exP 1 java spring spring-mvc maven spring-web
我已经为Web应用程序创建了Spring Maven项目(使用archetype maven-archetype-webapp).我需要绑定不同于localhost和不同端口的ip.我在资源文件夹中创建了文件"application.properties"并添加了以下行:
server.port=8001
server.address= 192.168.1.91
Run Code Online (Sandbox Code Playgroud)
但是在启动时它仍使用端口默认值8080,而ip仍然是localhost.
我的WebInitializer类是:
package guard;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[]{RootConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{WebConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[]{"*.html"};
}
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
3445 次 |
| 最近记录: |