我正在开发一个应用程序,它需要将一些配置存储在docker容器的/ etc/hosts文件中.我尝试了很多选项,但没有找到任何正确的方法在运行时修改/ etc/hosts文件.
我想通过Dockerfile或java代码来实现.我能够构建docker镜像并手动修改/ etc/hosts文件,但不幸的是,这不是我们的项目要求.
我正在学习春天并且遇到了一个问题.我尝试了很多,也谷歌分配.我知道很多人已经问过这个问题,他们解决了问题,我也对它们感到沮丧,但我仍然遇到同样的错误.因此,我在这里发布我的文件,请帮助我.我太努力但没有输出.
我的Web.xml看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我的spring-servlet.xml看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframew ork.org/schema/context">
<mvc:resources location="/images/" mapping="/images/**"/>
<mvc:resources location="/jsp/js/" mapping="/jsp/js/**"/>
<context:component-scan base-package="org.vinay.spring_mvc.mycontroller"></context:component-scan>
<context:annotation-config/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/employee">myController</prop>
</props>
</property>
</bean>
<bean id="myController" class="org.vinay.spring_mvc.mycontroller.MyController"></bean>
<bean …Run Code Online (Sandbox Code Playgroud)