最近很多小伙伴都在问Error:Removingunusedresourcesrequiresunusedcodeshrinkingtobeturnedon.这两个问题,那么本篇文章就来给大家详细解答
最近很多小伙伴都在问Error:Removing unused resources requires unused code shrinking to be turned on.这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展@Autowired(required = false) 的 @Resource实现不了?、An error occurred during the parsing of a resource required to service this request、C#WebService 出现No ''Access-Control-Allow-Origin'' header is present on the requested resource、Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml]...等相关知识,下面开始了哦!
本文目录一览:- Error:Removing unused resources requires unused code shrinking to be turned on.
- @Autowired(required = false) 的 @Resource实现不了?
- An error occurred during the parsing of a resource required to service this request
- C#WebService 出现No ''Access-Control-Allow-Origin'' header is present on the requested resource
- Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml]...
Error:Removing unused resources requires unused code shrinking to be turned on.
修改APP文件夹里面的build.gradle
[java] view plain copy
buildTypes {
debug {
signingConfig signingConfigs.release
buildConfigField "boolean", "ISDEBUG", "true"
debuggable true
<span style="color:#ff0000;">minifyEnabled true
shrinkResources true</span>
proguardFiles getDefaultProguardFile(''proguard-android.txt''), ''proguard-rules.pro''
}
release {
signingConfig signingConfigs.release
<span style="color:#ff0000;">minifyEnabled true</span>
zipAlignEnabled true
debuggable true
<span style="color:#ff0000;">shrinkResources true</span>
proguardFiles getDefaultProguardFile(''proguard-android.txt''), ''proguard-rules.pro''
}
}
@Autowired(required = false) 的 @Resource实现不了?
@Autowired(required = false) 没有替代实现方法?(字段上面有警告)
@Resource实现不了
An error occurred during the parsing of a resource required to service this request
如上是我写的一个WebServices发布后报错
1:目录结构如下:
2:从错误原因中的路径 class=Airticket.MVC.Service.TicketService.asmx 可看出路径不对,应该将Service 改为WebService,
3:手动改,改完即刻生效
4:完全是蒙对的,不清楚为什么,网上也没什么解释,如果亲你明白,一定要告诉我为什么会这样,谢谢。
C#WebService 出现No ''Access-Control-Allow-Origin'' header is present on the requested resource
解决方法:
打开Webservice的Web.config文件
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/>
<add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/>
<add name="Access-Control-Allow-Origin" value="*"/> // “*”表示允许所有的跨域访问,如果要设置只允许一个一个地址的跨域,则需将“*”替换成被允许的地址
</customHeaders>
</httpProtocol>
</system.webServer>
就可以解决跨域问题了
Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml]...
在尝试使用Spring的Test的时候遇到了这个错误
原来的代码:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"../../../resources/config/spring.xml"})
public class TestFund {
@Autowired
private FundService fundService;
@Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
原因分析:
修改spring的配置文件spring.xml的位置
解决方法:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:config/spring.xml")
public class TestFund {
@Autowired
private FundService fundService;
@Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
问题解决!
关于Error:Removing unused resources requires unused code shrinking to be turned on.的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于@Autowired(required = false) 的 @Resource实现不了?、An error occurred during the parsing of a resource required to service this request、C#WebService 出现No ''Access-Control-Allow-Origin'' header is present on the requested resource、Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml]...等相关内容,可以在本站寻找。
本文标签: