Since the 1830s, boosted by the conditions of proto-industrialization of the prior two centuries of the Catalan urban areas and its countryside, Catalonia became a centre of Spain's industrialization and it became one of the largest textile producers in the Mediterranean. In 1832 it was inaugurated in Barcelona the factory Bonaplata, the first of the country which worked with steam engine. Catalonia had to contend with a grave shortage of energy resources and the weakness of the domestic Spanish market. To encourage industrial expansion, Spain established protectionist policies which reduced foreign competition domestically (although the policy of Spanish government during those times changed many times between free trade and protectionism). Catalonia saw the first railway construction in the Iberian Peninsula in 1848, linking Barcelona with Mataró, built with private capital. These initiatives partially benefitted the country's industrial regions, Catalonia, the Basque Country and later Asturias. As in much of Europe, the working class was molded into an industrial proletariat, living and working in often inhuman conditions.